Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stronger type enforcement (feature request) #69537

Closed
JohnMichaelLafayette mannequin opened this issue Oct 9, 2015 · 2 comments
Closed

Stronger type enforcement (feature request) #69537

JohnMichaelLafayette mannequin opened this issue Oct 9, 2015 · 2 comments
Labels
type-feature A feature request or enhancement

Comments

@JohnMichaelLafayette
Copy link
Mannequin

JohnMichaelLafayette mannequin commented Oct 9, 2015

BPO 25350
Nosy @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2015-10-09.14:08:51.146>
created_at = <Date 2015-10-09.06:08:07.766>
labels = ['type-feature']
title = 'Stronger type enforcement (feature request)'
updated_at = <Date 2015-10-09.14:08:51.145>
user = 'https://bugs.python.org/JohnMichaelLafayette'

bugs.python.org fields:

activity = <Date 2015-10-09.14:08:51.145>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2015-10-09.14:08:51.146>
closer = 'r.david.murray'
components = []
creation = <Date 2015-10-09.06:08:07.766>
creator = 'John Michael Lafayette'
dependencies = []
files = []
hgrepos = []
issue_num = 25350
keywords = []
message_count = 2.0
messages = ['252588', '252614']
nosy_count = 2.0
nosy_names = ['r.david.murray', 'John Michael Lafayette']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue25350'
versions = []

@JohnMichaelLafayette
Copy link
Mannequin Author

JohnMichaelLafayette mannequin commented Oct 9, 2015

With a lot of languages, I can tell
that the type I am getting is an instance of the declared type I'm assigning it to.

Example:
Cat c = Factory.make("cat"
Animal d = Factory.make("dog")

Python:
val c = Factory.make("cat")

Problem with this is that it is not necessarily obvious to the reader what the type of c is. I suggest that you provide an option to strengthen python's type checking by allowing users to replace val with the expected type of the object and then allow the interpreter to check that the real type being assigned is an instance of the expected type. An option like -strong for strong typing.

@JohnMichaelLafayette JohnMichaelLafayette mannequin added the type-feature A feature request or enhancement label Oct 9, 2015
@bitdancer
Copy link
Member

Check out the types module and PEP-484.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant