Message159923
| Author |
larry |
| Recipients |
eric.smith, larry, mark.dickinson, serhiy.storchaka |
| Date |
2012年05月04日.11:13:57 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1336130038.65.0.758967815908.issue14705@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|