On 2018-12-17 21:57:22 +1100, Paul Baker wrote: > class C: > def __init__(self): > self.__dict__['a'] = 1 > > @property > def a(self): > return 2 > > o = C() > print(o.a) # Prints 2
What version of Python is this? I get a different result: Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> class C: ... def __init__(self): ... self.__dict__['a'] = 1 ... @property ... def a(self): ... return 2 ... >>> o = C() >>> o.a 1 hp -- _ | Peter J. Holzer | we build much bigger, better disasters now |_|_) | | because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list