strings and ints consistency - isinstance

John Gordon gordon at panix.com
Wed Sep 21 18:22:13 EDT 2016


In <d58843f4-0636-43e6-aa16-465c97d89868 at googlegroups.com> Sayth Renshaw <flebber.crue at gmail.com> writes:

> Trying to clarify why ints and strings arent treated the same.

Because they are not the same.

> You can get a valuerror from trying to cast a non-int to an int as in
> int(3.0) however you cannot do a non string with str(a).

Anything you type can be represented as a string*.  The same is
not true for integers.

* Okay, python 2.7 does have some issues with Unicode.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list