Terry Reedy wrote:
it is normal to look for special methods on the class (and superclasses)
> of an object rather than starting with the object itself.
I suspect there was a deliberate change to correct an anomaly, though
this might have been done as part of some other change.
It's a necess
On 9/22/2011 6:21 AM, Gavin Panella wrote:
On Python 2.6 and 3.1 the following code works fine:
class Foo(object):
@classmethod
def __enter__(cls):
print("__enter__")
@classmethod
def __exit__(cls, exc_type, exc_value, traceback):
Mel wrote:
> This seems to work:
>
>
>
> class MetaWith (type):
> @classmethod
> def __enter__(cls):
> print("__enter__")
>
> @classmethod
> def __exit__(cls, exc_type, exc_value, traceback):
> print("__exit__")
>
> class With (object):
> __metaclass__ = Met
Gavin Panella wrote:
> Hi,
>
> On Python 2.6 and 3.1 the following code works fine:
>
> class Foo(object):
>
> @classmethod
> def __enter__(cls):
> print("__enter__")
>
> @classmethod
> def __exit__(cls, exc_type, exc_value, traceback):
>
Am 22.09.2011 12:21 schrieb Gavin Panella:
Hi,
On Python 2.6 and 3.1 the following code works fine:
class Foo(object):
@classmethod
def __enter__(cls):
print("__enter__")
@classmethod
def __exit__(cls, exc_type, exc_value, traceback):
Hi,
On Python 2.6 and 3.1 the following code works fine:
class Foo(object):
@classmethod
def __enter__(cls):
print("__enter__")
@classmethod
def __exit__(cls, exc_type, exc_value, traceback):
print("__exit__")
with Foo