Python 3 May Become Relevant Now
jeanmichel at sequans.com
Mon Aug 3 11:58:14 CEST 2015
----- Original Message -----
> From: "Mark Lawrence" <breamoreboy at yahoo.co.uk>
> To: python-list at python.org
> Sent: Monday, 3 August, 2015 2:25:08 AM
> Subject: Python 3 May Become Relevant Now
> rr should have a field day with this one
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> Mark Lawrence
"The problem was with a function (buried deep in the source code as one of many decorators) that usually returned a list but under a certain circumstances, it returned None" [...] "I'm not saying that the person who originally wrote the code is a bad programmer. I'll leave that up to you. What I am saying is that python allows you to make such silly mistakes."
I do this all the time ... :(
Well not exactly, with lists I'm trying to return an empty list but I may return None in certain situations, most of the time when a method cannot do its job because of missing data but this particular method does not know if it's expected or not, so it returns "None" like to tell the caller, "can't do it, deal with it".
I really prefer to handle errors with a :
if foo() is not None:
than a try expect stupid block.
But if I get things right, with python 3.5 type hint checker, I'd be screwed, as it is spefificaly designed to track this kind of "problem".
What's the use of None then ? Any method returning None can only return None or suffer the type checker retribution.
I don't get it.
-- IMPORTANT NOTICE:
The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the Python-list