ignoring keywords on func. call

Steve Holden steve at holdenweb.com
Wed Apr 6 10:28:15 EDT 2005


Brano Zarnovican wrote:
>>>Q: Can you call 'f' with keywords that will be
>>> ignored, without changing 'f's definition ?
>>
>>no.
> 
> 
> OK. Thank you for an answer.
> 
> 
>>what's the use case?
> 
> 
> I have extended the dict class, so that my __getitem__ accepts an
> optional parameter
> 
[...]
> 
> But it still doesn't guarantee that __getitem__ accepts keywords.
> (What if somebody will extend the Tree class and overlook the
> definition of __getitem__ and define a "classic" one)
> 
Then they haven't programmed to your API, and deserve to be rewarded 
with an error message - it's the only way they can be informed they 
aren't writing to your standard, surely?

regards
  Steve
-- 
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/




More information about the Python-list mailing list