Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49509 > unrolled thread

Re: math functions with non numeric args

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2013-06-30 13:07 -0600
Last post2013-06-30 13:07 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: math functions with non numeric args Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-30 13:07 -0600

#49509 — Re: math functions with non numeric args

FromIan Kelly <ian.g.kelly@gmail.com>
Date2013-06-30 13:07 -0600
SubjectRe: math functions with non numeric args
Message-ID<mailman.4038.1372619286.3114.python-list@python.org>
On Sun, Jun 30, 2013 at 12:46 PM, Andrew Z <formisc@gmail.com> wrote:
> Hello,
>
> print max(-10, 10)
> 10
> print max('-10', 10)
> -10
>
> My guess max converts string to number bye decoding each of the characters
> to it's ASCII equivalent?

No, it leaves the types as they are but simply considers strings to be
"greater than" numbers.  As another poster stated, this is fixed in
Python 3, where strings and numbers are considered inorderable.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web