PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)

Chris Angelico rosuav at gmail.com
Thu Feb 13 14:17:56 EST 2014


On Fri, Feb 14, 2014 at 1:58 AM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.6824.1392265865.18130.python-list at python.org>,
>  Chris Angelico <rosuav at gmail.com> wrote:
>
>> Whether it's a module-level function, a bound method, a closure, or a
>> callable object, a zero-arg function in Python always has some kind of
>> implicit state.
>
> Sometimes, it has a *lot* of implicit state:
>
> os.fork()

os.fork() always returns 0, so it *clearly* has no state whatsoever.
It also always returns the next available PID, which is only a small
amount of extra state (from the OS). Nothing else affects its return
value!

ChrisA



More information about the Python-list mailing list