Re: CPython Class variable exposed to Python is altered.

2017-04-12 Thread Vincent Vande Vyvre
Le 12/04/17 à 11:47, Peter Otten a écrit : Vincent Vande Vyvre wrote: No, no warning. For the truth, this code is copy-pasted from the doc. https://docs.python.org/3.5//extending/newtypes.html#adding-data-and-methods-to-the-basic-example But the example expects objects (the big O), not str

Re: CPython Class variable exposed to Python is altered.

2017-04-12 Thread Peter Otten
Vincent Vande Vyvre wrote: > Le 12/04/17 à 10:51, Peter Otten a écrit : >> Vincent Vande Vyvre wrote: >> >>> Le 12/04/17 à 08:57, Vincent Vande Vyvre a écrit : Hi, Learning CPython, I've made this simple exercice, a module test which contains an object Test. The objec

Re: CPython Class variable exposed to Python is altered.

2017-04-12 Thread Vincent Vande Vyvre
Le 12/04/17 à 10:51, Peter Otten a écrit : Vincent Vande Vyvre wrote: Le 12/04/17 à 08:57, Vincent Vande Vyvre a écrit : Hi, Learning CPython, I've made this simple exercice, a module test which contains an object Test. The object Test has an attribute name, fixed at instanciation. So, I tr

Re: CPython Class variable exposed to Python is altered.

2017-04-12 Thread Peter Otten
Vincent Vande Vyvre wrote: > Le 12/04/17 à 08:57, Vincent Vande Vyvre a écrit : >> Hi, >> >> Learning CPython, I've made this simple exercice, a module test which >> contains an object Test. >> >> The object Test has an attribute name, fixed at instanciation. >> >> So, I try my code with a script:

Re: CPython Class variable exposed to Python is altered.

2017-04-12 Thread Vincent Vande Vyvre
Le 12/04/17 à 08:57, Vincent Vande Vyvre a écrit : Hi, Learning CPython, I've made this simple exercice, a module test which contains an object Test. The object Test has an attribute name, fixed at instanciation. So, I try my code with a script: --- f

CPython Class variable exposed to Python is altered.

2017-04-12 Thread Vincent Vande Vyvre
Hi, Learning CPython, I've made this simple exercice, a module test which contains an object Test. The object Test has an attribute name, fixed at instanciation. So, I try my code with a script: --- from test import Test for n in ("The name", "Foo", "