Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49506 > unrolled thread
| Started by | Andrew Z <formisc@gmail.com> |
|---|---|
| First post | 2013-06-30 14:46 -0400 |
| Last post | 2013-06-30 20:57 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
math functions with non numeric args Andrew Z <formisc@gmail.com> - 2013-06-30 14:46 -0400
Re: math functions with non numeric args Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-06-30 20:57 +0200
| From | Andrew Z <formisc@gmail.com> |
|---|---|
| Date | 2013-06-30 14:46 -0400 |
| Subject | math functions with non numeric args |
| Message-ID | <mailman.4036.1372618018.3114.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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?
Where can i read more on exactly how the situations like these are dealt
with?
Thank you
AZ
[toc] | [next] | [standalone]
| From | Irmen de Jong <irmen.NOSPAM@xs4all.nl> |
|---|---|
| Date | 2013-06-30 20:57 +0200 |
| Message-ID | <51d07f85$0$15997$e4fe514c@news.xs4all.nl> |
| In reply to | #49506 |
On 30-6-2013 20:46, Andrew Z 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?
>
> Where can i read more on exactly how the situations like these are dealt with?
>
> Thank you
> AZ
>
Use Python 3.x instead.
>>> max('-10',10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: int() > str()
>>>
Irmen
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web