4 ms·
Plus Swift goes directly against the Zen of Python The Zen of Python is how we got crap like argparse where arguments are placed in the namespace instead of a
by commandersaki 7mo ago
Plus Swift goes directly against the Zen of Python
The Zen of Python is how we got crap like argparse where arguments are placed in the namespace instead of a dict.
- coldtea 7mo agoI wouldn't change that in any way. I'd might make it an Arguments class, but I wound't make what parser returns merely a dict.
- commandersaki 7mo agoYeah, so what happens when you have an option with a '-' in it that isn't valid as a variable name (I know what happens). It's just stupid.
- coldtea 7mo agoThe same thing you'd do yoursef if you wanted to assign it to a namesake local variable even if it was in a dict to begin with: you'd make the dash an underscore.
- commandersaki 7mo agoIt would be extremely unlikely that you would replicate the name as a local variable if it was in a dict, but regardless a dict doesn't have that limitation. The namespace thing is atrocious and bad design -- no straightforward way to iterate over them, merging/updating them is awful, collides with keyword methods (keys, items, etc.), and so on; thankfully more modern argument parsing libraries didn't repeat this mistake. It's just a shame this ended up in the standard library, but then Python standard library has never really been any good, e.g. logging and urllib1234567.
- coldtea 7mo ago>It would be extremely unlikely that you would replicate the name as a local variable if it was in a dict If you had some feature flag args, you'd keep accessing them via the dict? Highly unlikely...