On 2018-08-02 7:01 PM, Eric Fahlgren wrote:
On Thu, Aug 2, 2018 at 3:39 PM MRAB <pyt...@mrabarnett.plus.com <mailto:pyt...@mrabarnett.plus.com>> wrote:

    In the relevant code, is policy.mangle_from_ ever None?


That's impossible to know, since the initializer where this code originally appears puts no constraints on the value of 'policy', it's just assumed to have a 'mangle_from_' member...  I would be paranoid and assume, yes, it can take on a value of None as there's nothing to indicate that it can't.

I would make the opposite argument and claim that since when policy is None mangle_from_ is initialised to True and not None, None is likely not a potential value for policy.mangle_from_. Looking at Lib/email/_policybase.py where the abstract policy class in question is defined, policies default their mangle_from_ to False, which gives additional credence to the notion that policy.mangle_from_ is not meant to be None.

So yes, *strictly speaking* the two chunks of code are not exactly the same. In practice, they'll act the same way given sensible inputs.

Alex
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to