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 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 wrote: > > > >> Physics is the fundamental science, at l

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 wrote: > In article <53176225$0$29987$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano 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

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 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 correct, because he had - as is k

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 wrote: > >> Physics is the fundamental science, at least according to the >> physicists, and Real Soon Now they'll have a Theory Of Everything, >> something

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 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 eve

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 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 wrong. I suggest you read the

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 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 know >> what just

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

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 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 everything. At least > in principle. Eve

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 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. >>

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 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 may have tri

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 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

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 conside

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

2014-03-04 Thread Roy Smith
In article , Rustom Mody 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 classical/platonic mathematician (subject to wooly thinking) concludes > that > the

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

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 Albert van der Horst
In article , 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 power of two. > >And n

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

2014-03-04 Thread Albert van der Horst
In article , Ian Kelly wrote: >On Mon, Mar 3, 2014 at 11:35 PM, Chris Angelico 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 infin

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 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 * next

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 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 to see if the

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 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 non-integers -

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 pr

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 Chris Angelico
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 > > http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html#s

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 > >

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 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 64-bit float) in the

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

2014-03-03 Thread Albert van der Horst
In article , Chris Angelico wrote: >On Wed, Feb 12, 2014 at 7:17 PM, Ben Finney wrote: >> Chris Angelico 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*

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 pa

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 wrote: > Chris Angelico 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

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 delibe

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 q

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 r

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 no

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) >

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 not

Re: Finding size of Variable

2014-02-12 Thread Chris Angelico
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 integers than with any

Re: Finding size of Variable

2014-02-12 Thread Jussi Piitulainen
Chris Angelico writes: > On Wed, Feb 12, 2014 at 6:49 PM, 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, Fractions,

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 c

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 wrote: > Chris Angelico 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

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

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

2014-02-12 Thread Ben Finney
Chris Angelico 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 numbers”, in a w

Re: Finding size of Variable

2014-02-12 Thread Chris Angelico
On Wed, Feb 12, 2014 at 6:49 PM, 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 mind optimization

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 (

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 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

Re: Finding size of Variable

2014-02-11 Thread Neil Cerutti
On 2014-02-10, Ned Batchelder 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-1

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, P

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 > wors

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) type(('a

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) >>> type(('a' * 100 + 'oe' + '\U

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 Py

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-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 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 9:56 PM, David Hutto wrote: On Sat, Feb 8, 2014 at 8:25 PM, Rustom Mody 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 one, that those 9 b

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 9:59 PM, Chris Angelico wrote: > On Sun, Feb 9, 2014 at 1:56 PM, David Hutto > 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 > > prot

Re: Finding size of Variable

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 1:56 PM, David Hutto 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 > code...dufus.

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 8:25 PM, Rustom Mody 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 file. Of, course w

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 go

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 8:17 AM, Mark Lawrence wrote: > 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 se

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-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~ -- https://mail.python.org/mailman/listinfo/pyth

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' + 'EURO')

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

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 > > s

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 sum([sys.getsizeof(c.encode('utf-32

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 > > 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 proba

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 can

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 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

Re: Finding size of Variable

2014-02-05 Thread Dave Angel
Ayushi Dalmia 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 Chris Angelico
On Wed, Feb 5, 2014 at 10:00 PM, Steven D'Aprano 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 strings have a fair bit of fixed

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 ite

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 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

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') > > > >

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 stopW

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) > > > >

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 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 specif

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 > > declaimed the following: > > > > > > >I need to chunk out the outputs otherwise it will give Memory Error. I need > >to do some postprocessing on the data

Re: Finding size of Variable

2014-02-04 Thread Tim Golden
On 04/02/2014 19:21, Dave Angel wrote: Ayushi Dalmia 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 "total" size of a list of stri

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 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 Ayushi Dalmia
On Tuesday, February 4, 2014 6:39:00 PM UTC+5:30, Dave Angel wrote: > Ayushi Dalmia 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,

Re: Finding size of Variable

2014-02-04 Thread Dave Angel
Ayushi Dalmia 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 instead con

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 l

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 h

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'

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