3 Suggestions to Make Python Easier For Children
Marko Rauhamaa
marko at pacujo.net
Sat Aug 2 14:33:46 EDT 2014
Mark Lawrence <breamoreboy at yahoo.co.uk>:
> On 02/08/2014 18:07, Marko Rauhamaa wrote:
>> And the newest Python releases let you replace that with:
>>
>> import types
>> Object = types.SimpleNamespace
>
> With the latter being part of suggestion #3 in the original post.
Not quite. Even though Sugg. #3 would allow me to do:
object(x=3)
this wouldn't work:
object().x = 3
However, these would continue working:
types.SimpleNamespace(x=3)
types.SimpleNamespace().x = 3
Also, assuming Sugg. #3, would this work:
object(x=3).y = 2
as this does:
types.SimpleNamespace(x=3).y = 2
Marko
More information about the Python-list
mailing list