Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Steven D'Aprano
Following up on my own post. On Wed, 05 Mar 2014 07:52:01 +, Steven D'Aprano wrote: On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote: I stopped paying attention to mathematicians when they tried to convince me that the sum of all natural numbers is -1/12. [...] In effect, the author

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread wxjmfauth
Mathematics? The Flexible String Representation is a very nice example of a mathematical absurdity. jmf PS Do not even think to expect to contradict me. Hint: sheet of paper and pencil. -- https://mail.python.org/mailman/listinfo/python-list

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Oscar Benjamin
On 5 March 2014 07:52, Steven D'Aprano st...@pearwood.info wrote: On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote: I stopped paying attention to mathematicians when they tried to convince me that the sum of all natural numbers is -1/12. I'm pretty sure they did not. Possibly a physicist

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2014 12:21:37 +, Oscar Benjamin wrote: On 5 March 2014 07:52, Steven D'Aprano st...@pearwood.info wrote: On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote: I stopped paying attention to mathematicians when they tried to convince me that the sum of all natural numbers is

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Chris Angelico
On Thu, Mar 6, 2014 at 4:43 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Physics is the fundamental science, at least according to the physicists, and Real Soon Now they'll have a Theory Of Everything, something small enough to print on a tee-shirt, which will explain

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Chris Kaynor
On Wed, Mar 5, 2014 at 9:43 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: At one time, Euler summed an infinite series and got -1, from which he concluded that -1 was (in some sense) larger than infinity. I don't know what justification he gave, but the way I think of it is

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Grant Edwards
On 2014-03-05, Chris Kaynor ckay...@zindagigames.com wrote: On Wed, Mar 5, 2014 at 9:43 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: At one time, Euler summed an infinite series and got -1, from which he concluded that -1 was (in some sense) larger than infinity. I don't

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Oscar Benjamin
On 5 March 2014 17:43, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 05 Mar 2014 12:21:37 +, Oscar Benjamin wrote: The argument that the sum of all natural numbers comes to -1/12 is just some kind of hoax. I don't think *anyone* seriously believes it. You would be

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Roy Smith
In article 53176225$0$29987$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Physics is the fundamental science, at least according to the physicists, and Real Soon Now they'll have a Theory Of Everything, something small enough to print on a

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Steven D'Aprano
On Wed, 05 Mar 2014 21:31:51 -0500, Roy Smith wrote: In article 53176225$0$29987$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Physics is the fundamental science, at least according to the physicists, and Real Soon Now they'll have a Theory

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Chris Angelico
On Thu, Mar 6, 2014 at 2:06 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: They ask a computer programmer to adjudicate who is right, so he writes a program to print out all the primes: 1 is prime 1 is prime 1 is prime 1 is prime 1 is prime And he claimed that he was

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Grant Edwards
On 2014-03-06, Roy Smith r...@panix.com wrote: In article 53176225$0$29987$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Physics is the fundamental science, at least according to the physicists, and Real Soon Now they'll have a Theory Of

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Roy Smith
In article 5317e640$0$29985$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 05 Mar 2014 21:31:51 -0500, Roy Smith wrote: In article 53176225$0$29987$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Ian Kelly
On Mon, Mar 3, 2014 at 11:35 PM, Chris Angelico ros...@gmail.com wrote: In constant space, that will produce the sum of two infinite sequences of digits. (And it's constant time, too, except when it gets a stream of nines. Adding three thirds together will produce an infinite loop as it waits

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Ian Kelly
On Tue, Mar 4, 2014 at 4:19 AM, Ian Kelly ian.g.ke...@gmail.com wrote: def cf_sqrt(n): Yield the terms of the square root of n as a continued fraction. m = 0 d = 1 a = a0 = floor_sqrt(n) while True: yield a next_m = d * a - m next_d = (n - next_m

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Albert van der Horst
In article mailman.7702.1393932047.18130.python-l...@python.org, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Mar 3, 2014 at 11:35 PM, Chris Angelico ros...@gmail.com wrote: In constant space, that will produce the sum of two infinite sequences of digits. (And it's constant time, too, except

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Albert van der Horst
In article mailman.7687.1393902132.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Tue, Mar 4, 2014 at 1:45 PM, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: No, the Python built-in float type works with a subset of real numbers: To be more precise: a subset of

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Steven D'Aprano
On Wed, 05 Mar 2014 02:15:14 +, Albert van der Horst wrote: Adding cf's adds all computable numbers in infinite precision. However that is not even a drop in the ocean, as the computable numbers have measure zero. On the other hand, it's not really clear that the non-computable numbers

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Rustom Mody
On Wednesday, March 5, 2014 9:11:13 AM UTC+5:30, Steven D'Aprano wrote: On Wed, 05 Mar 2014 02:15:14 +, Albert van der Horst wrote: Adding cf's adds all computable numbers in infinite precision. However that is not even a drop in the ocean, as the computable numbers have measure zero.

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Roy Smith
In article c39d5b44-6c7b-40d1-bbb5-791a36af6...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: I cannot find the exact quote so from memory Weyl says something to this effect: Cantor's diagonalization PROOF is not in question. Its CONCLUSION very much is. The

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-04 Thread Steven D'Aprano
On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote: I stopped paying attention to mathematicians when they tried to convince me that the sum of all natural numbers is -1/12. I'm pretty sure they did not. Possibly a physicist may have tried to tell you that, but most mathematicians consider

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-03 Thread Albert van der Horst
In article mailman.6735.1392194885.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Wed, Feb 12, 2014 at 7:17 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Angelico ros...@gmail.com writes: I have yet to find any computer that works with the set of real numbers

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 1:45 PM, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: No, the Python built-in float type works with a subset of real numbers: To be more precise: a subset of the rational numbers, those with a denominator that is a power of two. And no more than N bits (53 in a

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-03 Thread Rustom Mody
On Tuesday, March 4, 2014 8:32:01 AM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 1:45 PM, Albert van der Horst wrote: No, the Python built-in float type works with a subset of real numbers: To be more precise: a subset of the rational numbers, those with a denominator that is a

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 2:13 PM, Rustom Mody rustompm...@gmail.com wrote: But it's a far cry from all real numbers. Even allowing for continued fractions adds only some more; I don't think you can represent surds that way. See

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-03 Thread Rustom Mody
On Tuesday, March 4, 2014 9:16:25 AM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 2:13 PM, Rustom Mody wrote: But it's a far cry from all real numbers. Even allowing for continued fractions adds only some more; I don't think you can represent surds that way. See

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-03 Thread Steven D'Aprano
On Tue, 04 Mar 2014 14:46:25 +1100, Chris Angelico wrote: That's neat, didn't know that. Is there an efficient way to figure out, for any integer N, what its sqrt's CF sequence is? And what about the square roots of non-integers - can you represent √π that way? I suspect, though I can't

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 4:53 PM, Steven D'Aprano st...@pearwood.info wrote: On Tue, 04 Mar 2014 14:46:25 +1100, Chris Angelico wrote: That's neat, didn't know that. Is there an efficient way to figure out, for any integer N, what its sqrt's CF sequence is? And what about the square roots of

Re: Finding size of Variable

2014-02-12 Thread Chris Angelico
On Wed, Feb 12, 2014 at 6:49 PM, wxjmfa...@gmail.com wrote: The day you find an operator working on the set of reals (R) and it is somehow optimized for N (the subset of natural numbers), let me know. I have yet to find any computer that works with the set of real numbers in any way. Never

Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: I have yet to find any computer that works with the set of real numbers in any way. Never mind optimization, they simply cannot work with real numbers. Not *any* computer? Not in *any* way? The Python built-in ‘float’ type “works with the set of real

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread wxjmfauth
Integers are integers. (1) Characters are characters. (2) (1) is a unique natural set. (2) is an artificial construct working with 3 sets (unicode). jmf -- https://mail.python.org/mailman/listinfo/python-list

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread Chris Angelico
On Wed, Feb 12, 2014 at 7:17 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Angelico ros...@gmail.com writes: I have yet to find any computer that works with the set of real numbers in any way. Never mind optimization, they simply cannot work with real numbers. Not *any* computer?

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread wxjmfauth
Le mercredi 12 février 2014 09:35:38 UTC+1, wxjm...@gmail.com a écrit : Integers are integers. (1) Characters are characters. (2) (1) is a unique natural set. (2) is an artificial construct working with 3 sets (unicode). jmf Addendum: One should not confuse unicode and

Re: Finding size of Variable

2014-02-12 Thread Jussi Piitulainen
Chris Angelico writes: On Wed, Feb 12, 2014 at 6:49 PM, wxjmfa...@gmail.com wrote: The day you find an operator working on the set of reals (R) and it is somehow optimized for N (the subset of natural numbers), let me know. ... In Python, integers have arbitrary precision, but floats,

Re: Finding size of Variable

2014-02-12 Thread Chris Angelico
On Wed, Feb 12, 2014 at 7:57 PM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: In Python, integers have arbitrary precision, but floats, Fractions, and Decimals, don't. Nearly any operation on arbitrarily large numbers will be either more accurate or more efficient (maybe both) with

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread Jussi Piitulainen
Chris Angelico writes: On Wed, Feb 12, 2014 at 7:17 PM, Ben Finney wrote: What specific behaviour would, for you, qualify as “works with the set of real numbers in any way”? Being able to represent surds, pi, e, etc, for a start. It'd theoretically be possible with an algebraic notation

Re: Finding size of Variable

2014-02-12 Thread Jussi Piitulainen
Chris Angelico writes: On Wed, Feb 12, 2014 at 7:57 PM, Jussi Piitulainen wrote: In Python, integers have arbitrary precision, but floats, Fractions, and Decimals, don't. Nearly any operation on arbitrarily large numbers will be either more accurate or more efficient (maybe both) with

Re: Finding size of Variable

2014-02-12 Thread Mark Lawrence
On 12/02/2014 07:49, wxjmfa...@gmail.com wrote: Le mardi 11 février 2014 20:04:02 UTC+1, Mark Lawrence a écrit : On 11/02/2014 18:53, wxjmfa...@gmail.com wrote: Le lundi 10 février 2014 15:43:08 UTC+1, Tim Chase a écrit : On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does

Re: Finding size of Variable

2014-02-12 Thread Rustom Mody
On Wednesday, February 12, 2014 7:34:42 PM UTC+5:30, Mark Lawrence wrote: I ask you, members of the jury, to find the accused, jmf, guilty of writing nonsense and deliberately using google groups to double line space. The evidence is directly above and quite clearly prooves, beyond a

Re: Finding size of Variable

2014-02-12 Thread Mark Lawrence
On 12/02/2014 14:14, Rustom Mody wrote: On Wednesday, February 12, 2014 7:34:42 PM UTC+5:30, Mark Lawrence wrote: I ask you, members of the jury, to find the accused, jmf, guilty of writing nonsense and deliberately using google groups to double line space. The evidence is directly above and

Re: Finding size of Variable

2014-02-12 Thread Rustom Mody
On Wednesday, February 12, 2014 7:55:32 PM UTC+5:30, Mark Lawrence wrote: On 12/02/2014 14:14, Rustom Mody wrote: On Wednesday, February 12, 2014 7:34:42 PM UTC+5:30, Mark Lawrence wrote: I ask you, members of the jury, to find the accused, jmf, guilty of writing nonsense and deliberately

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread Grant Edwards
On 2014-02-12, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Angelico ros...@gmail.com writes: I have yet to find any computer that works with the set of real numbers in any way. Never mind optimization, they simply cannot work with real numbers. Not *any* computer? Not in *any* way?

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-02-12 Thread Gisle Vanem
Grant Edwards wrote: Not *any* computer? Not in *any* way? The Python built-in float type works with the set of real numbers, in a way. The only people who think that are people who don't actualy _use_ floating point types on computers. FPU parsing the IEEE spec, or?. I didn't quite parse

Re: Finding size of Variable

2014-02-11 Thread Neil Cerutti
On 2014-02-10, Ned Batchelder n...@nedbatchelder.com wrote: On 2/10/14 9:43 AM, Tim Chase wrote: The opposite of what the utf8/utf16 do! sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) 123 sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-16'))

Re: Finding size of Variable

2014-02-11 Thread wxjmfauth
Le lundi 10 février 2014 15:43:08 UTC+1, Tim Chase a écrit : On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly characters which are consuming less memory.

Re: Finding size of Variable

2014-02-11 Thread Mark Lawrence
On 11/02/2014 18:53, wxjmfa...@gmail.com wrote: Le lundi 10 février 2014 15:43:08 UTC+1, Tim Chase a écrit : On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly

Re: Finding size of Variable

2014-02-11 Thread wxjmfauth
Le mardi 11 février 2014 20:04:02 UTC+1, Mark Lawrence a écrit : On 11/02/2014 18:53, wxjmfa...@gmail.com wrote: Le lundi 10 février 2014 15:43:08 UTC+1, Tim Chase a écrit : On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string)

Re: Finding size of Variable

2014-02-10 Thread wxjmfauth
Le samedi 8 février 2014 03:48:12 UTC+1, Steven D'Aprano a écrit : We consider it A GOOD THING that Python spends memory for programmer convenience and safety. Python looks for memory optimizations when it can save large amounts of memory, not utterly trivial amounts. So in a Python

Re: Finding size of Variable

2014-02-10 Thread Asaf Las
On Monday, February 10, 2014 4:07:14 PM UTC+2, wxjm...@gmail.com wrote: Interesting sys.getsizeof('a' * 100) here you get string type sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) and here bytes type ('a' * 1) class 'str' type(('a' * 100 + 'oe' +

Re: Finding size of Variable

2014-02-10 Thread Mark Lawrence
On 10/02/2014 14:25, Asaf Las wrote: On Monday, February 10, 2014 4:07:14 PM UTC+2, wxjm...@gmail.com wrote: Interesting sys.getsizeof('a' * 100) here you get string type sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) and here bytes type ('a' * 1) class

Re: Finding size of Variable

2014-02-10 Thread Tim Chase
On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly characters which are consuming less memory. Not only the memory gain is zero, Python falls back to the worse

Re: Finding size of Variable

2014-02-10 Thread Ned Batchelder
On 2/10/14 9:43 AM, Tim Chase wrote: On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly characters which are consuming less memory. Not only the memory gain is zero,

Re: Finding size of Variable

2014-02-08 Thread Mark Lawrence
On 08/02/2014 02:48, Steven D'Aprano wrote: On Thu, 06 Feb 2014 05:51:54 -0800, wxjmfauth wrote: Sorry, I'm only pointing you may lose memory when working with short strings as it was explained. I really, very really, do not see what is absurd or obsure in: sys.getsizeof('abc' + 'EURO') 46

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 8:17 AM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 08/02/2014 02:48, Steven D'Aprano wrote: On Thu, 06 Feb 2014 05:51:54 -0800, wxjmfauth wrote: Sorry, I'm only pointing you may lose memory when working with short strings as it was explained. I really, very

Re: Finding size of Variable

2014-02-08 Thread Rustom Mody
On Sunday, February 9, 2014 4:15:50 AM UTC+5:30, David Hutto wrote: One could argue that if you're parsing a particular file, a very large one, that those 9 bytes can go into the optimization of parsing aforementioned file. Of, course we have faster processors, so why care? Because it goes

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 8:25 PM, Rustom Mody rustompm...@gmail.com wrote: On Sunday, February 9, 2014 4:15:50 AM UTC+5:30, David Hutto wrote: One could argue that if you're parsing a particular file, a very large one, that those 9 bytes can go into the optimization of parsing aforementioned

Re: Finding size of Variable

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 1:56 PM, David Hutto dwightdhu...@gmail.com wrote: Yes... There are cases when python is an inappropriate language to use... So??? I didn't say she couldn't optimize in another language, and was just prototyping in Python. I just said she was optimizing her python

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 9:59 PM, Chris Angelico ros...@gmail.com wrote: On Sun, Feb 9, 2014 at 1:56 PM, David Hutto dwightdhu...@gmail.com wrote: Yes... There are cases when python is an inappropriate language to use... So??? I didn't say she couldn't optimize in another language,

Re: Finding size of Variable

2014-02-08 Thread Ned Batchelder
On 2/8/14 9:56 PM, David Hutto wrote: On Sat, Feb 8, 2014 at 8:25 PM, Rustom Mody rustompm...@gmail.com mailto:rustompm...@gmail.com wrote: On Sunday, February 9, 2014 4:15:50 AM UTC+5:30, David Hutto wrote: One could argue that if you're parsing a particular file, a very large

Re: Finding size of Variable

2014-02-08 Thread David Hutto
Maybe I'll just roll my fat, bald, troll arse out from under the bridge, and comment back, off list, next time. -- https://mail.python.org/mailman/listinfo/python-list

Re: Finding size of Variable

2014-02-08 Thread Ned Batchelder
On 2/8/14 10:09 PM, David Hutto wrote: Maybe I'll just roll my fat, bald, troll arse out from under the bridge, and comment back, off list, next time. I'm not sure what happened in this thread. It might be that you think Rustom Mody was referring to you when he said, BTW: In my book this

Re: Finding size of Variable

2014-02-08 Thread Rustom Mody
On Sunday, February 9, 2014 8:46:50 AM UTC+5:30, Ned Batchelder wrote: On 2/8/14 10:09 PM, David Hutto wrote: Maybe I'll just roll my fat, bald, troll arse out from under the bridge, and comment back, off list, next time. I'm not sure what happened in this thread. It might be that you

Re: Finding size of Variable

2014-02-07 Thread Steven D'Aprano
On Thu, 06 Feb 2014 05:51:54 -0800, wxjmfauth wrote: Sorry, I'm only pointing you may lose memory when working with short strings as it was explained. I really, very really, do not see what is absurd or obsure in: sys.getsizeof('abc' + 'EURO') 46 sys.getsizeof(('abc' +

Re: Finding size of Variable

2014-02-07 Thread Ethan Furman
On 02/07/2014 06:48 PM, Steven D'Aprano wrote: That is not a trade-off that the core developers have chosen to make, and I agree with them. Even though you haven't broken all the build-bots yet, you can still stop saying them. ;) -- ~Ethan~ --

Re: Finding size of Variable

2014-02-06 Thread wxjmfauth
Le mercredi 5 février 2014 12:44:47 UTC+1, Chris Angelico a écrit : On Wed, Feb 5, 2014 at 10:00 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: where stopWords.txt is a file of size 4KB My guess is that if you split a 4K file into words, then put the words into

Re: Finding size of Variable

2014-02-06 Thread Ned Batchelder
On 2/6/14 5:15 AM, wxjmfa...@gmail.com wrote: sum([sys.getsizeof(c) for c in ['a', 'a EURO', 'aa EURO']*3]) 336 sum([sys.getsizeof(c) for c in ['aa EURO aa EURO']*3]) 150 sum([sys.getsizeof(c.encode('utf-32')) for c in ['a', 'a EURO', 'aa EURO']*3]) 261

Re: Finding size of Variable

2014-02-06 Thread wxjmfauth
Le jeudi 6 février 2014 12:10:08 UTC+1, Ned Batchelder a écrit : On 2/6/14 5:15 AM, wxjmfa...@gmail.com wrote: sum([sys.getsizeof(c) for c in ['a', 'a EURO', 'aa EURO']*3]) 336 sum([sys.getsizeof(c) for c in ['aa EURO aa EURO']*3]) 150

Re: Finding size of Variable

2014-02-06 Thread wxjmfauth
Some mysterious problem with the euro. Let's take a real French char. sys.getsizeof('abc' + 'œ') 46 sys.getsizeof(('abc' + 'œ').encode('utf-32')) 37 or a German char, ẞ sys.getsizeof('abc' + '\N{LATIN CAPITAL LETTER SHARP S}') 46 sys.getsizeof(('abc' + '\N{LATIN CAPITAL LETTER SHARP

Re: Finding size of Variable

2014-02-05 Thread Peter Otten
Ayushi Dalmia wrote: On Wednesday, February 5, 2014 12:51:31 AM UTC+5:30, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing

Re: Finding size of Variable

2014-02-05 Thread Steven D'Aprano
On Tue, 04 Feb 2014 21:35:05 -0800, Ayushi Dalmia wrote: On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: On 2014-02-04 14:21, Dave Angel wrote: To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a

Re: Finding size of Variable

2014-02-05 Thread Chris Angelico
On Wed, Feb 5, 2014 at 10:00 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: where stopWords.txt is a file of size 4KB My guess is that if you split a 4K file into words, then put the words into a list, you'll probably end up with 6-8K in memory. I'd guess rather more; Python

Re: Finding size of Variable

2014-02-05 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: On 2014-02-04 14:21, Dave Angel wrote: To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist:

Re: Finding size of Variable

2014-02-05 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 7:13:34 PM UTC+5:30, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: On 2014-02-04 14:21, Dave Angel wrote: To get the total size of a list of

Re: Finding size of Variable

2014-02-05 Thread Mark Lawrence
On 05/02/2014 14:33, Ayushi Dalmia wrote: Please stop sending double line spaced messages, just follow the instructions here https://wiki.python.org/moin/GoogleGroupsPython to prevent this happening, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you

Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
Hello, I have 10 files and I need to merge them (using K way merging). The size of each file is around 200 MB. Now suppose I am keeping the merged data in a variable named mergedData, I had thought of checking the size of mergedData using sys.getsizeof() but it somehow doesn't gives the actual

Re: Finding size of Variable

2014-02-04 Thread Peter Otten
Ayushi Dalmia wrote: I have 10 files and I need to merge them (using K way merging). The size of each file is around 200 MB. Now suppose I am keeping the merged data in a variable named mergedData, I had thought of checking the size of mergedData using sys.getsizeof() but it somehow doesn't

Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 5:10:25 PM UTC+5:30, Peter Otten wrote: Ayushi Dalmia wrote: I have 10 files and I need to merge them (using K way merging). The size of each file is around 200 MB. Now suppose I am keeping the merged data in a variable named mergedData, I had thought

Re: Finding size of Variable

2014-02-04 Thread Asaf Las
On Tuesday, February 4, 2014 2:43:21 PM UTC+2, Ayushi Dalmia wrote: As I said, I need to merge large files and I cannot afford more I/O operations. So in order to minimise the I/O operation I am writing in chunks. Also, I need to use the merged files as indexes later which should be

Re: Finding size of Variable

2014-02-04 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: getsizeof() gives you the size of the list only; to complete the picture you have to add the sizes of the lines. However, why do you want to keep track of the actual memory used by variables in your script? You should

Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 6:39:00 PM UTC+5:30, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: getsizeof() gives you the size of the list only; to complete the picture you have to add the sizes of the lines. However, why do

Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 6:23:19 PM UTC+5:30, Asaf Las wrote: On Tuesday, February 4, 2014 2:43:21 PM UTC+2, Ayushi Dalmia wrote: As I said, I need to merge large files and I cannot afford more I/O operations. So in order to minimise the I/O operation I am writing in

Re: Finding size of Variable

2014-02-04 Thread Tim Chase
On 2014-02-04 14:21, Dave Angel wrote: To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a += sys.getsizeof (item) I always find this sort of accumulation weird (well, at least in Python; it's the *only* way in many other

Re: Finding size of Variable

2014-02-04 Thread Tim Golden
On 04/02/2014 19:21, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing your code, or even properly specifying your problem. To get the

Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Tuesday, February 4, 2014 7:36:48 PM UTC+5:30, Dennis Lee Bieber wrote: On Tue, 4 Feb 2014 05:19:48 -0800 (PST), Ayushi Dalmia ayushidalmia2...@gmail.com declaimed the following: I need to chunk out the outputs otherwise it will give Memory Error. I need to do some

Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 12:51:31 AM UTC+5:30, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing your code, or even

Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: On 2014-02-04 14:21, Dave Angel wrote: To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a += sys.getsizeof (item) I always find this

Re: Finding size of Variable

2014-02-04 Thread Rustom Mody
On Wednesday, February 5, 2014 11:05:05 AM UTC+5:30, Ayushi Dalmia wrote: This also doesn't gives the true size. I did the following: import sys data=[] f=open('stopWords.txt','r') for line in f: line=line.split() data.extend(line) print sys.getsizeof(data) where stopWords.txt

Re: Finding size of Variable

2014-02-04 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 11:15:09 AM UTC+5:30, Rustom Mody wrote: On Wednesday, February 5, 2014 11:05:05 AM UTC+5:30, Ayushi Dalmia wrote: This also doesn't gives the true size. I did the following: import sys data=[] f=open('stopWords.txt','r') for line in f: