[Python-Dev] Disallow float arguments where an integer is expected in Python 2.7. (original) (raw)

Brett Cannon brett at python.org
Mon Dec 21 18:03:10 CET 2009


On Mon, Dec 21, 2009 at 07:02, Mark Dickinson <dickinsm at gmail.com> wrote:

In Python 2.7, PyArgParseTuple and friends currently accept a float argument where an integer is expected, but produce a DeprecationWarning in this case. This can be seen in various places in Python proper:

>>> itertools.combinations(range(5), 2.0) main:1: DeprecationWarning: integer argument expected, got float <itertools.combinations object at 0x10059f638> Are there any objections to turning this DeprecationWarning into a TypeError for Python 2.7? The behaviour has been deprecated since Python 2.3, it's gone in 3.x, and having it produce an error in 2.7 might slightly reduce the number of surprises involved in porting from 2.x to 3.x. There's a patch at http://bugs.python.org/issue5080 I'm +0

-Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20091221/1b196767/attachment.htm>



More information about the Python-Dev mailing list