Message223570
| Author |
Julien.Palard |
| Recipients |
Arfrever, Julien.Palard, Ramchandra Apte, brian.curtin, eric.araujo, eric.snow, ezio.melotti, gregory.p.smith, gruszczy, meatballhat, rhettinger |
| Date |
2014年07月21日.10:13:53 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1405937634.01.0.917053924496.issue8706@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I think for some builtins it may be usefull to have keyword arguments, in the case they take more than one parameter.
Typically, it's impossible to write:
self.drop_elements(partial(isinstance, type(lxml.etree.Comment)))
Because isinstance take its argument in the "other" order, we may bypass this using keywords arguments:
self.drop_elements(partial(isinstance, type=type(lxml.etree.Comment)))
But isinstance refuses keyword arguments, so there is no way to write this without a lambda:
self.drop_elements(lambda x: isinstance(x,
type(lxml.etree.Comment)))
With is cool and work, I agree, it's just an example to explicitly show why keywords argument may be cool: functools.partial. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年07月21日 10:13:54 | Julien.Palard | set | recipients:
+ Julien.Palard, rhettinger, gregory.p.smith, ezio.melotti, eric.araujo, Arfrever, brian.curtin, gruszczy, meatballhat, eric.snow, Ramchandra Apte |
| 2014年07月21日 10:13:54 | Julien.Palard | set | messageid: <1405937634.01.0.917053924496.issue8706@psf.upfronthosting.co.za> |
| 2014年07月21日 10:13:53 | Julien.Palard | link | issue8706 messages |
| 2014年07月21日 10:13:53 | Julien.Palard | create |
|