Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84147
| References | (2 earlier) <54bfedf5$0$2876$e4fe514c@news.xs4all.nl> <CAPTjJmrZ42_bVHiHy2pnGUOjkmuUCimkqSDDL7fmTg-u_vJxuQ@mail.gmail.com> <54C01802.7020202@case.edu> <CAPTjJmo-ZKpQzn7dodM9SnvJ_HcKMwNhP6rpXczkoB-qQoAJhw@mail.gmail.com> <54C01E2A.3040602@case.edu> |
|---|---|
| Date | 2015-01-22 09:22 +1100 |
| Subject | Re: How to "wow" someone new to Python |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17925.1421878963.18130.python-list@python.org> (permalink) |
On Thu, Jan 22, 2015 at 8:46 AM, Matthew Ruffalo <mmr15@case.edu> wrote: > No, Java's String.length returns an int and Strings are limited to ~2 ** > 31 characters even in 64-bit Java. Huh, annoying. In Python, the length of a string (in characters) is stored in a Py_ssize_t (if I recall correctly), which is, I believe, a pointer-sized integer. So it'd be 64-bit on a 64-bit build. > I do seem to have encountered some strange behavior, though: creating > very large strings with str.__mul__ seems to enter an allocation loop in > Python 3.4. With a single-character string 's', I can create the > following new strings quickly: > > s * 2 ** 33 > s * 2 ** 34 > s * 2 ** 35 > s * 2 ** 36 > > but s * 2 ** 38 shows some odd memory usage. I'm watching the memory > usage of a Python process steadily increase to 256GB, drop to a few MB, > climb back to 256GB, drop to a few MB, and so on. It takes a half-dozen > cycles of allocation and deallocation before the interactive interpreter > gives me another prompt. That sounds like you're blooping through your page file. The exact behaviour will depend on how much physical memory you have, how your page file is implemented (which depends on your OS), the phase of the moon, and what you had for breakfast three weeks ago. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to "wow" someone new to Python Chris Angelico <rosuav@gmail.com> - 2015-01-17 02:03 +1100
Re: How to "wow" someone new to Python Marko Rauhamaa <marko@pacujo.net> - 2015-01-16 17:20 +0200
Re: How to "wow" someone new to Python Rustom Mody <rustompmody@gmail.com> - 2015-01-16 09:16 -0800
Re: How to "wow" someone new to Python alex23 <wuwei23@gmail.com> - 2015-01-19 16:19 +1000
Re: How to "wow" someone new to Python wxjmfauth@gmail.com - 2015-01-21 07:15 -0800
Re: How to "wow" someone new to Python Steve Hayes <hayesstw@telkomsa.net> - 2015-01-21 19:59 +0200
Re: How to "wow" someone new to Python Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-01-21 19:20 +0100
Re: How to "wow" someone new to Python Chris Angelico <rosuav@gmail.com> - 2015-01-22 06:06 +1100
Re: How to "wow" someone new to Python André Roberge <andre.roberge@gmail.com> - 2015-01-21 11:20 -0800
Re: How to "wow" someone new to Python Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-01-22 00:46 +0100
Re: How to "wow" someone new to Python Matthew Ruffalo <mmr15@case.edu> - 2015-01-21 16:20 -0500
Re: How to "wow" someone new to Python Chris Angelico <rosuav@gmail.com> - 2015-01-22 08:26 +1100
Re: How to "wow" someone new to Python Alan Bawden <alan@scooby-doo.csail.mit.edu> - 2015-01-21 16:44 -0500
Re: How to "wow" someone new to Python Alan Bawden <alan@scooby-doo.csail.mit.edu> - 2015-01-21 16:52 -0500
Re: How to "wow" someone new to Python Paul Rubin <no.email@nospam.invalid> - 2015-01-21 14:35 -0800
Re: How to "wow" someone new to Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-22 15:51 +1100
Re: How to "wow" someone new to Python Mario Figueiredo <marfig@gmail.com> - 2015-01-21 23:13 +0100
Re: How to "wow" someone new to Python Matthew Ruffalo <mmr15@case.edu> - 2015-01-21 16:46 -0500
Re: How to "wow" someone new to Python Chris Angelico <rosuav@gmail.com> - 2015-01-22 09:22 +1100
Re: How to "wow" someone new to Python André Roberge <andre.roberge@gmail.com> - 2015-01-21 10:34 -0800
Re: How to "wow" someone new to Python Mario Figueiredo <marfig@gmail.com> - 2015-01-21 19:05 +0000
Re: How to "wow" someone new to Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-22 15:39 +1100
Re: How to "wow" someone new to Python Grant Edwards <invalid@invalid.invalid> - 2015-01-23 00:09 +0000
csiph-web