Message223570
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. |
|
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 | |
|