Message182862
| Author |
serhiy.storchaka |
| Recipients |
Arfrever, barry, carsten.klein@axn-software.de, ezio.melotti, georg.brandl, larry, mark.dickinson, r.david.murray, rhettinger, serhiy.storchaka, terry.reedy |
| Date |
2013年02月24日.09:19:56 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1361697596.46.0.0269710641319.issue16801@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
It's cumbersome and burdensome because you need for every nonstandard default value:
1) define a class with __repr__();
2) instantiate a sentinel;
3) check for the sentinel in the function and replace it but an actual value.
class _ExternalAttrDefault:
def __repr__():
return '(stat.S_IRUSR|stat.S_IRUSR)<<16'
_external_attr_default = _ExternalAttrDefault()
def open(self, name, mode='r', external_attr=_external_attr_default):
if external_attr is _external_attr_default:
external_attr = (stat.S_IRUSR|stat.S_IRUSR)<<16
...
Instead of just:
def open(self, name, mode='r', external_attr=(stat.S_IRUSR|stat.S_IRUSR)<<16):
"""
Foo.open(name, mode='r', external_attr=(stat.S_IRUSR|stat.S_IRUSR)<<16)
"""
... |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年02月24日 09:19:56 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, barry, georg.brandl, rhettinger, terry.reedy, mark.dickinson, larry, ezio.melotti, Arfrever, r.david.murray, carsten.klein@axn-software.de |
| 2013年02月24日 09:19:56 | serhiy.storchaka | set | messageid: <1361697596.46.0.0269710641319.issue16801@psf.upfronthosting.co.za> |
| 2013年02月24日 09:19:56 | serhiy.storchaka | link | issue16801 messages |
| 2013年02月24日 09:19:56 | serhiy.storchaka | create |
|