On 12/26/2010 11:49 AM, kj wrote:
In Ian
Kelly writes:
On 12/26/2010 10:53 AM, kj wrote:
P.S. If you uncomment the commented-out line, and comment out the
last line of the __init__ method (which installs self._delitem as
self.__delitem__) then *all* the deletion attempts invoke the
__delite
In <4d181afb$0$30001$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano
writes:
>We know it because it explains the observable facts.
So does Monday-night quarterbacking...
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 26 Dec 2010 18:49:55 +, kj wrote:
> In Ian Kelly
> writes:
>
>>On 12/26/2010 10:53 AM, kj wrote:
>>> P.S. If you uncomment the commented-out line, and comment out the last
>>> line of the __init__ method (which installs self._delitem as
>>> self.__delitem__) then *all* the deletion
Am 26.12.2010 19:49, schrieb kj:
> How do you know this? Is this documented? Or is this a case of
> Monday-night quarterbacking?
Please stop bitching around. You know that by carefully reading the
documentation:
http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-
In Ian Kelly
writes:
>On 12/26/2010 10:53 AM, kj wrote:
>> P.S. If you uncomment the commented-out line, and comment out the
>> last line of the __init__ method (which installs self._delitem as
>> self.__delitem__) then *all* the deletion attempts invoke the
>> __delitem__ method, and are there
Am 26.12.2010 18:53, schrieb kj:
> It means that, for both subclasses, del fails to trigger the
> dynamically installed instance method __delitem__.
Magic methods like __delitem__ are looked up on the type, not on the
instance. You can't change the behaviour on instances.
> If I replace dict with
On 12/26/2010 10:53 AM, kj wrote:
P.S. If you uncomment the commented-out line, and comment out the
last line of the __init__ method (which installs self._delitem as
self.__delitem__) then *all* the deletion attempts invoke the
__delitem__ method, and are therefore blocked. FWIW.
Because subcl
When I execute this file:
#--
def nodelfactory(klass):
class nodel(klass):
def _delitem(self, _):
raise TypeError("can't delete")
# __delitem__ = _delitem
def __init__(self, *a, **k):