How to "wow" someone new to Python
mmr15 at case.edu
Wed Jan 21 22:20:02 CET 2015
On 01/21/2015 02:06 PM, Chris Angelico wrote:
> On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong <irmen.NOSPAM at xs4all.nl> wrote:
>> On 21-1-2015 18:59, Steve Hayes wrote:
>>> 3. When I started to look at it, I found that strings could be any length and
>>> were not limited to swomething arbitrary, like 256 characters.
>> Even more fun is that Python's primitive integer type (longs for older Python versions)
>> has no arbitrary limitation either.
>> That amazed me at the time I discovered python :)
> I hadn't worked with length-limited strings in basically forever
> (technically BASIC has a length limit, but I never ran into it; and I
> never did much with Pascal), but you're right, arbitrary-precision
> integers would have impressed me a lot more if I hadn't first known
> REXX. So... is there a way to show that off efficiently? Normally, any
> calculation that goes beyond 2**32 has already gone way beyond most
> humans' ability to hold the numbers in their heads.
Yes, length-unlimited strings are *extremely* useful in some
applications. I remember bitterly cursing Java's string length limit of
2 ** 31 (maybe - 1) on multiple occasions. Python's strings seem to
behave like integers in that their size is limited only by available memory.
More information about the Python-list