A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-April/099429.html below:

[Python-Dev] Very Strange Argument Handling Behavior

[Python-Dev] Very Strange Argument Handling Behavior [Python-Dev] Very Strange Argument Handling BehaviorHagen Fürstenau hagen at zhuliguan.net
Fri Apr 16 10:04:38 CEST 2010
> This behavior seems pretty strange to me, indeed PyPy gives the
> TypeError for both attempts.  I just wanted to confirm that it was in
> fact intentional.

Oleg already answered why f(**{1:3}) raises a TypeError. But your
question seems to be rather why dict(**{1:3}) doesn't.

For functions implemented in Python, non-string arguments are always
rejected, but C functions (like the dict constructor) don't have to
reject them. I don't see any benefit in allowing them, but it's probably
not worth breaking code by disallowing them either.

I couldn't find this documented. Perhaps we should just say "don't rely
on being able to pass non-string keywords" somewhere?

- Hagen
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4