workhorsy / py-cpuinfo

A module for getting CPU info with pure Python
MIT License
312 stars 59 forks source link

Avoid mutable default arguments #189

Open DimitriPapadopoulos opened 2 years ago

DimitriPapadopoulos commented 2 years ago
DimitriPapadopoulos commented 2 years ago

I believe this is not needed here, but you may change back None[] at the beginning of the modified functions:

def modified_function(machine_code=None):
    machine_code = machine_code or []

The above will change machine_code to [] not only if it is None, but also False or 0. But I think it is OK in this context.

DimitriPapadopoulos commented 1 year ago

And argtypes=() is OK because tuples are not mutable.

workhorsy commented 1 year ago

I want to merge this later, as it changes the API, and will require me to bump the version up to 10.0.0.