Larry Hastings <la...@hastings.org> added the comment:

I looked through the Python sources and couldn't find any instances of a  
function or method with an argument that only allowed you to pass in either 
True or False.

Serily already said he would use 'P' over 'p', although I too am unconvinced 
that's a good idea.  Serily: why would you unhesitatingly prefer 'P' to 'p'?


Certainly I see loads of uses for 'p'.  For example, when converting code from 
Python to C that already relied on Python's standard definition of truthiness.

I did find some spots that took an object and converted to bool with 
PyObject_IsTrue, like _json.Encoder(allow_nan) and 
pickle._Pickler(fix_imports).  These too would be well-served by 'p'.

I also found some funny in-between cases.  For example, stat_float_times and 
the three-argument form of os.symlink both claim to take a boolean but actually 
take 'i' (integer).  This is relying on bool.__int__().  We certainly couldn't 
use 'P' here.  We could consider switching these to 'p', though in all 
likelyhood we'll just leave 'em alone.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14705>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to