A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-August/017012.html below:

[Python-Dev] 2.2a1: classmethod() and class attributes

[Python-Dev] 2.2a1: classmethod() and class attributes [Python-Dev] 2.2a1: classmethod() and class attributesGuido van Rossum guido@python.org
Mon, 13 Aug 2001 23:59:29 -0400
> One little hole that I don't see an answer to is what happens when
> you do this:
> 
> class C(object):
>     x = 0
>     def foo(cls):
>         cls.x += 1
>     foo = classmethod(foo)
> 
> C.foo()

As written, you get TypeError: can't set type attributes.

If you add __dynamic__ = 1 to the class statement, it works as
expected.

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4