simphony / simphony-metadata

[LEGACY] This repository contains the metadata definitions used in SimPhoNy project.
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Some mutable defaults are not replaced with None in the generator #36

Closed kitchoi closed 8 years ago

kitchoi commented 8 years ago

The generator has taken care of default = [] and replaced it with None in the __init__, but not for defaults such as [0., 0., 0.], so you end up with def __init__(something=[0., 0., 0.]).

For the current generated classes, there is however no sharing of mutable objects among instances because these default values are first copied and validated before being saved to the data container. However, it is considered a common practice not to have mutables as arguments' defaults.