Extending the dict class

Duncan Booth duncan.booth at invalid.invalid
Tue Aug 29 09:18:24 EDT 2006


chosechu wrote:

> 
> Duncan Booth wrote:
>> If the order of the argument names matters, then it seems to me that
>> should be handled by the SOAP library, not pushed onto the end user
>> whoch should just be calling the function with the named arguments in
>> the most convenient order.
>>
>> Shouldn't SOAPpy be able to get this information out of the WSDL?
> 
> Yes, SOAPpy could extract this from the WSDL specs.
> SOAPpy could also find another way to pass call parameters, but I
> kinda like
> the named parameters (seems really Python-like). Microsoft could also
> build SOAP services that parse XML without making ordering mandatory
> where
> nobody said it was.

Indeed, the spec says that parameterOrder is a hint and may be safely 
ignored.

> 
> ... but we are living in a different dimension, one where I can extend
> the Python dict class but not touch 2 of its 3 constructors (of course
> the most
> useful ones).

No, you weren't able to extend the builtin dict class nor touch any its 
constructor.

All you did was to create a subclass with its own constructor and hide the 
name for the builtin dictionary type. The original type was still unchanged 
as you can see since anything which constructed a dictionary without using 
the name you had overwritten still got the original type.

If you had looked at type(dict()) and type({}) after your subclassing, you 
would see that they are different types.



More information about the Python-list mailing list