Tom Ritchford
Jul 6, 2024

--

Or with strings that are keywords: try dict(return=1).

Also, using dict instead of {} is slower, because Python has to look up the variable dict (which might be overridden in some scope), construct a dictionary of the arguments, and then pass that dictionary to dict to generate the final result.

Using dict is a worse way, not a better way, because it can't represent all dictionaries, and it's slower.

--

--

No responses yet