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: Functional programming

2014-03-03 Thread Rustom Mody
On Tuesday, March 4, 2014 11:34:55 AM UTC+5:30, Chris Angelico wrote: > On Tue, Mar 4, 2014 at 4:35 PM, Steven D'Aprano wrote: > > I have not used Haskell enough to tell you whether you can specify > > subtypes. I know that, at least for numeric (integer) types, venerable > > old Pascal allows you

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 4:35 PM, Steven D'Aprano wrote: > On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote: >> x = 23 # Compiler goes: Okay, x takes ints. x += 5 # Compiler: No prob, >> int += int --> int x = str(x) # Compiler: NO WAY! str(int) --> str, not >> allowed! >> >> It's fine and c

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Tuesday, March 4, 2014 11:05:24 AM UTC+5:30, Steven D'Aprano wrote: > On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote: > > It's not possible to > > sub-specify a type (like the "string('a'..'x')" type in Pike that will > > take only strings with nothing but the first 24 lower-case lett

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: Functional programming

2014-03-03 Thread Steven D'Aprano
On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote: > On Tue, Mar 4, 2014 at 4:27 AM, Steven D'Aprano > wrote: >> On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote: >> >>> This is why it's tricky to put rules in based on type inference. The >>> programmer's intent isn't in the pictur

Re: 3.4rc2 and pip on windows

2014-03-03 Thread Terry Reedy
On 3/3/2014 2:47 PM, Mark Lawrence wrote: On 03/03/2014 00:07, Terry Reedy wrote: On 3/2/2014 6:55 PM, Mark Lawrence wrote: Trying to install pyttsx, it doesn't strike me as very clever that, as seen below, you get "Successfully installed pyttsx" despite the syntax errors and you can't actually

Re: Reference

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 3:52 PM, Steven D'Aprano wrote: > This is why, unless performance is *really* critical, one should normally > write x*2 when multiplying x by 2 rather than x >> 1. (And in Python, the > overhead means that there is no real performance benefit to using bit > shifts instead of

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

2014-03-03 Thread Steven D'Aprano
On Tue, 04 Mar 2014 00:22:55 +0200, Marko Rauhamaa wrote: > Jerry Hill : > >> except for the fact that there has been 20 years of custom saying that >> comparing to None with equality is wrong. > > "if foo == None" is not wrong in any manner. It's just that if you are > comfortable with the "is"

Re: How do I process this?

2014-03-03 Thread John Gordon
In Igor Korot writes: > --047d7b6dc250a1426004f3bffd8d > Content-Type: text/plain; charset=ISO-8859-1 > Hi, ALL, > I have a csv file which depending on how it was produced gives 2 different > strings as shown in the example below (test1 and test2). > I am only interested in the first field in

Re: Reference

2014-03-03 Thread Steven D'Aprano
On Mon, 03 Mar 2014 18:02:04 -0500, Roy Smith wrote: > In article , > Ben Finney wrote: > >> That's right. Python provides this singleton and then recommends you >> compare with ‘is’, precisely to protect against pathological cases like >> a “return True when compared for equality with None” da

Re: How do I process this?

2014-03-03 Thread Zachary Ware
On Mon, Mar 3, 2014 at 10:03 PM, Igor Korot wrote: > Hi, ALL, > I have a csv file which depending on how it was produced gives 2 different > strings as shown in the example below (test1 and test2). > I am only interested in the first field in test1 and obviously in the whole > string of test2. > >

Re: How do I process this?

2014-03-03 Thread Tim Chase
On 2014-03-03 20:03, Igor Korot wrote: > Hi, ALL, > I have a csv file which depending on how it was produced gives 2 > different strings as shown in the example below (test1 and test2). > I am only interested in the first field in test1 and obviously in > the whole string of test2. > > So, I tried

How do I process this?

2014-03-03 Thread Igor Korot
Hi, ALL, I have a csv file which depending on how it was produced gives 2 different strings as shown in the example below (test1 and test2). I am only interested in the first field in test1 and obviously in the whole string of test2. So, I tried to see if I can get what I want in one simple way, b

Re: Reference

2014-03-03 Thread Steven D'Aprano
On Mon, 03 Mar 2014 17:02:14 -0500, Jerry Hill wrote: > On Mon, Mar 3, 2014 at 4:51 PM, Tim Chase > wrote: >> There are a couple use-cases I've encountered where "is" matters: >> >> 1) the most popular: >> >> if foo is None: >> do_stuff() > > I know this is the one that always comes up, bu

Re: Reference

2014-03-03 Thread Steven D'Aprano
On Mon, 03 Mar 2014 13:48:39 -0500, Terry Reedy wrote: > On 3/3/2014 4:42 AM, ast wrote: > >> Consider following code: >> > A=7 > B=7 > A is B > > The 'is' operator has three uses, two intended and one not. In > production code, 'is' tests that an object *is* a particular singular >

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: 3.4rc2 and pip on windows

2014-03-03 Thread Ned Deily
In article , Zachary Ware wrote: > On Mon, Mar 3, 2014 at 3:48 PM, Zachary Ware > wrote: > > It could be argued that Pip could compile any .py files that it > > installs and just start screaming if it gets any SyntaxError, but what > > if your package (for some weird reason) relies on .py file

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: Idle thread (Polling) python GUI and saving program state

2014-03-03 Thread Rolando
On Monday, March 3, 2014 6:06:22 PM UTC-8, MRAB wrote: > On 2014-03-04 01:33, Rolando wrote: > > > I have a GUI with a bunch of cells which is my "View" in the MVC > > > design. The user enters some information in the view and I pass this > > > on to the model so that using the information en

Re: 3.4rc2 and pip on windows

2014-03-03 Thread Zachary Ware
On Mon, Mar 3, 2014 at 3:48 PM, Zachary Ware wrote: > It could be argued that Pip could compile any .py files that it > installs and just start screaming if it gets any SyntaxError, but what > if your package (for some weird reason) relies on .py file with bad > syntax? Somehow, I missed that thi

Re: Origin of 'self'

2014-03-03 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On Sun, 2 Mar 2014 22:16:31 -0800 (PST), Westley Martínez > declaimed the following: > > >I understand that in an object method the first argument in the object > >itself, called self. However, it doesn't have to be called self, and can be > >called a

Re: Origin of 'self'

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 1:09 PM, Dennis Lee Bieber wrote: > On Sun, 2 Mar 2014 22:16:31 -0800 (PST), Westley Martínez > declaimed the following: > >>I understand that in an object method the first argument in the object >>itself, called self. However, it doesn't have to be called self, and can b

Re: Idle thread (Polling) python GUI and saving program state

2014-03-03 Thread MRAB
On 2014-03-04 01:33, Rolando wrote: > I have a GUI with a bunch of cells which is my "View" in the MVC > design. The user enters some information in the view and I pass this > on to the model so that using the information entered by the user > it(model) can do some processing. > > I have coded up

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 5:34:30 AM UTC-6, Mark H. Harris wrote: > https://code.google.com/p/pythondecimallibrary/ I released my pdeclib module this afternoon on PyPI here: https://pypi.python.org/pypi/pdeclib/0.3 The tarball.gz may be downloaded and installed with: pip install pdeclib

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 4:44:27 PM UTC-6, Wolfgang Maier wrote: > decimal can handle BIGNUMS fairly well, you just need to increase context > Emax. Have you ever tried to calculate stuff with ints as big as MAX_EMAX > (10**99) or even close to it and still had a responsive > sy

Idle thread (Polling) python GUI and saving program state

2014-03-03 Thread Rolando
I have a GUI with a bunch of cells which is my "View" in the MVC design. The user enters some information in the view and I pass this on to the model so that using the information entered by the user it(model) can do some processing. I have coded up my model as a state machine. Wherein, once a f

Re: pip and distutils2-1.0a4

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 4:11:44 PM UTC-6, Robert Kern wrote: >http://docs.python.org/3/distutils/index.html > Robert Kern hi Robert, I'm not whining --really-- but there is so dang much doc out there on how to upload a package to PyPI with every tool under the sun and all of them fancier t

Re: Functional programming

2014-03-03 Thread 88888 Dihedral
On Monday, March 3, 2014 10:08:11 PM UTC+8, Rustom Mody wrote: > On Monday, March 3, 2014 7:30:17 PM UTC+5:30, Chris Angelico wrote: > > > On Tue, Mar 4, 2014 at 12:48 AM, Rustom Mody wrote: > > > > ? [1,2] + [[3,4],[5]] > > > > ERROR: Type error in application > > > > *** expression : [1,2

Re: Functional programming

2014-03-03 Thread Ben Finney
Chris Angelico writes: > On Tue, Mar 4, 2014 at 9:31 AM, Ben Finney wrote: > > def frobnicate(flang, splets, queeble=False): > > """ Righteously frobnicate the flang. > > > > :param flang: A file-like object, opened for reading. > > I had to read that a few times before I

Re: How security holes happen

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 10:05 AM, Roy Smith wrote: > In article , > Cameron Simpson wrote: > >> On 03Mar2014 09:17, Neal Becker wrote: >> > Charles R Harris Wrote in message: >> > > >> > >> > Imo the lesson here is never write in low level c. Use modern >> > languages with well designed excep

Re: How security holes happen

2014-03-03 Thread Roy Smith
In article , Cameron Simpson wrote: > On 03Mar2014 09:17, Neal Becker wrote: > > Charles R Harris Wrote in message: > > > > > > > Imo the lesson here is never write in low level c. Use modern > > languages with well designed exception handling. > > What, and rely on someone else's low lev

Re: Reference

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 10:02 AM, Roy Smith wrote: > In article , > Ben Finney wrote: > >> That's right. Python provides this singleton and then recommends you >> compare with ‘is’, precisely to protect against pathological cases like >> a “return True when compared for equality with None” data t

Re: How security holes happen

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 9:55 AM, Chris Kaynor wrote: > You can go much simpler than that. Merely port Python to LISP, then write a > LISP interpreter in Python. Done. Actually, here's an easier way. Just write an 80x86 assembly language interpreter in Python, then port CPython to Python. ChrisA -

Re: Reference

2014-03-03 Thread Roy Smith
In article , Ben Finney wrote: > That's right. Python provides this singleton and then recommends you > compare with ‘is’, precisely to protect against pathological cases like > a “return True when compared for equality with None” data type. Going off on a tangent, I've often wished Pyt

Re: How security holes happen

2014-03-03 Thread Chris Kaynor
On Mon, Mar 3, 2014 at 2:25 PM, Chris Angelico wrote: > On Tue, Mar 4, 2014 at 9:19 AM, Cameron Simpson wrote: > > On 03Mar2014 09:17, Neal Becker wrote: > >> Charles R Harris Wrote in message: > >> > > >> > >> Imo the lesson here is never write in low level c. Use modern > >> languages with

Re: How security holes happen

2014-03-03 Thread Mark Lawrence
On 03/03/2014 22:25, Chris Angelico wrote: On Tue, Mar 4, 2014 at 9:19 AM, Cameron Simpson wrote: On 03Mar2014 09:17, Neal Becker wrote: Charles R Harris Wrote in message: Imo the lesson here is never write in low level c. Use modern languages with well designed exception handling.

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 4:15:39 PM UTC-6, Wolfgang Maier wrote: > Well, that may be your use-case, but then math.factorial is for you. > On the other hand, you may be interested in getting > context-rounded factorials and rounding to context > precision is what you'd expect from a Decimal func

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Wolfgang Maier
On Monday, March 3, 2014 10:18:37 PM UTC+1, Mark H. Harris wrote: > On Monday, March 3, 2014 2:03:19 PM UTC-6, Mark H. Harris wrote: > > Wolfgang, answer is not so much, in fact, not at all. > But it is an interesting question for me; where I am > continuing to learn the limits of Decimal, and

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 9:31 AM, Ben Finney wrote: > def frobnicate(flang, splets, queeble=False): > """ Righteously frobnicate the flang. > > :param flang: A file-like object, opened for reading. I had to read that a few times before I was sure that you actually meant "fil

Re: Reference

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 9:22 AM, Marko Rauhamaa wrote: > You generally use "==" if more than one object could be equal. If you > know there's only one object of the kind, you convey that knowledge by > the use of "is" even when functionally, it doesn't matter. It's even simpler than that. You use

Re: How security holes happen

2014-03-03 Thread Cameron Simpson
On 03Mar2014 09:17, Neal Becker wrote: > Charles R Harris Wrote in message: > > > > Imo the lesson here is never write in low level c. Use modern > languages with well designed exception handling. What, and rely on someone else's low level C? -- Cameron Simpson Hag:Two

Re: Reference

2014-03-03 Thread Ben Finney
Marko Rauhamaa writes: > Jerry Hill : > > > except for the fact that there has been 20 years of custom saying that > > comparing to None with equality is wrong. > > "if foo == None" is not wrong in any manner. Marko, please don't keep asserting falsehoods. It's already been pointed out in this f

Re: How security holes happen

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 9:19 AM, Cameron Simpson wrote: > On 03Mar2014 09:17, Neal Becker wrote: >> Charles R Harris Wrote in message: >> > >> >> Imo the lesson here is never write in low level c. Use modern >> languages with well designed exception handling. > > What, and rely on someone else'

Re: Reference

2014-03-03 Thread Marko Rauhamaa
Jerry Hill : > except for the fact that there has been 20 years of custom saying that > comparing to None with equality is wrong. "if foo == None" is not wrong in any manner. It's just that if you are comfortable with the "is" operator and its semantics, "if foo is None" is slightly more natural.

Re: Functional programming

2014-03-03 Thread Ben Finney
Gregory Ewing writes: > Just because the compiler *can* infer the return type doesn't > necessarily mean it *should*. When I was playing around with > functional languages, I ended up adopting the practice of always > declaring the types of my functions, because it helps the *human* > reader. Su

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Wolfgang Maier
On Monday, March 3, 2014 9:03:19 PM UTC+1, Mark H. Harris wrote: > On Monday, March 3, 2014 11:23:13 AM UTC-6, Wolfgang Maier wrote: > > def fact(x): > > """ fact(x)factorial{x} int x > 0 > > > > return +Decimal(math.factorial(x) > > to make it return a Decimal rounded to co

Re: Reference

2014-03-03 Thread Ben Finney
Marko Rauhamaa writes: > Mark Lawrence : > > > I'd just like to know why people are so obsessed with identities, I've > > never thought to use them in 10+ years of writing Python. Do I use the > > KISS principle too often? > > Calmly choosing the right tool for the job is not an obsession. Pers

Re: Reference

2014-03-03 Thread Ben Finney
Jerry Hill writes: > if foo == None: > do_stuff() > > The only time it would give you a different result from the "is" > version is if foo was bound to an object that returned True when > compared with None. That's right. Python provides this singleton and then recommends you compare with ‘i

Re: 3.4rc2 and pip on windows

2014-03-03 Thread Zachary Ware
On Mon, Mar 3, 2014 at 1:47 PM, Mark Lawrence wrote: > FTR I raised this as http://bugs.python.org/issue20846 and it was closed 11 > minutes after I raised it. I won't say anything else as I'm extremely tired > and irritable and might well regret it later. Best I can tell, the issue was closed c

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 3:18:37 PM UTC-6, Mark H. Harris wrote: Yeah, you can set Emin & Emax enormously large (or small), can set off overflow, and set clamping. I am needing a small utility (tk?) that will allow the context to be set manually by the interactive user dynamically (for a particu

Re: pip and distutils2-1.0a4

2014-03-03 Thread Robert Kern
On 2014-03-03 21:37, Mark H. Harris wrote: On Monday, March 3, 2014 3:32:43 PM UTC-6, Robert Kern wrote: Probably. If you want us to help, you need to show us what you tried, tell us what results you expected, and copy-paste the output that you got. Robert Kern hi Robert, well, I finally

Re: Functional programming

2014-03-03 Thread Gregory Ewing
Steven D'Aprano wrote: Given that x is an integer, and that you add 1 (also an integer) to it, is it really necessary to tell the compiler that add_one returns an integer? What else could the output type be? Just because the compiler *can* infer the return type doesn't necessarily mean it *sho

Re: Reference

2014-03-03 Thread Marko Rauhamaa
Mark Lawrence : > I'd just like to know why people are so obsessed with identities, I've > never thought to use them in 10+ years of writing Python. Do I use the > KISS principle too often? Calmly choosing the right tool for the job is not an obsession. Marko -- https://mail.python.org/mailma

Re: Reference

2014-03-03 Thread Jerry Hill
On Mon, Mar 3, 2014 at 4:51 PM, Tim Chase wrote: > There are a couple use-cases I've encountered where "is" matters: > > 1) the most popular: > > if foo is None: > do_stuff() I know this is the one that always comes up, but honestly, I feel like "is" doesn't matter here. That code would be

Re: how to get bytes from bytearray without copying

2014-03-03 Thread Cameron Simpson
On 03Mar2014 09:15, Juraj Ivančić wrote: > On 3.3.2014. 1:44, Cameron Simpson wrote: > >>ValueError: cannot hash writable memoryview object > > > >Have you considered subclassing memoryview and giving the subclass > >a __hash__ method? > > I have, and then, when I failed to subclass it, I conside

Re: Reference

2014-03-03 Thread Tim Chase
On 2014-03-03 21:35, Mark Lawrence wrote: > I'd just like to know why people are so obsessed with identities, > I've never thought to use them in 10+ years of writing Python. Do > I use the KISS principle too often? There are a couple use-cases I've encountered where "is" matters: 1) the most po

Re: pip and distutils2-1.0a4

2014-03-03 Thread Roy Smith
In article <31feb451-7fb6-48a6-9986-bddce69c4...@googlegroups.com>, "Mark H. Harris" wrote: > On Monday, March 3, 2014 3:32:43 PM UTC-6, Robert Kern wrote: > > > Probably. If you want us to help, you need to show us what you tried, tell > > us > > what results you expected, and copy-paste the

Re: why indentation should be part of the syntax

2014-03-03 Thread BartC
"Stefan Behnel" wrote in message news:mailman.7568.1393756930.18130.python-l...@python.org... Haven't seen any mention of it on this list yet, but since it's such an obvious flaw in quite a number of programming languages, here's a good article on the recent security bug in iOS, which was due

Re: pip and distutils2-1.0a4

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 3:32:43 PM UTC-6, Robert Kern wrote: > Probably. If you want us to help, you need to show us what you tried, tell us > what results you expected, and copy-paste the output that you got. > Robert Kern hi Robert, well, I finally came up with trying to find setup(). Its

Re: Reference

2014-03-03 Thread Mark Lawrence
On 03/03/2014 21:10, Ben Finney wrote: Rustom Mody writes: Short answer: Avoid using 'is'. This is bad advice in a Python forum. The ‘is’ operator is commonly used in Python, so please don't advise against it in an unqualified “short answer”. Long answer: http://www.beyondwilber.ca/heali

Re: pip and distutils2-1.0a4

2014-03-03 Thread Robert Kern
On 2014-03-03 21:20, Mark H. Harris wrote: On Monday, March 3, 2014 2:53:00 PM UTC-6, Mark Lawrence wrote: distutils has been part of the standard library for years. hi Mark, that's fabulous, why can't I import it? Because I'm doing something wrong of course. :) Probably. If you want us t

Re: Reference

2014-03-03 Thread Ben Finney
Tim Chase writes: > On 2014-03-04 08:10, Ben Finney wrote: > > Short answer: Use ‘use’ any time you need to compare object > > identity. You usually do not need to compare object identity. Damn it, a snappy response marred by a typo. > I think there use something wrong with that sentence...unle

Re: pip and distutils2-1.0a4

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 2:53:00 PM UTC-6, Mark Lawrence wrote: > distutils has been part of the standard library for years. hi Mark, that's fabulous, why can't I import it? Because I'm doing something wrong of course. :) marcus -- https://mail.python.org/mailman/listinfo/python-list

Re: Reference

2014-03-03 Thread Tim Chase
On 2014-03-04 08:10, Ben Finney wrote: > > Long answer: > > http://www.beyondwilber.ca/healing-thinking/non-identity-korzybski.html > > Interesting, but mostly a distraction for the querent here. > > Short answer: Use ‘use’ any time you need to compare object > identity. You usually do not need

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 2:03:19 PM UTC-6, Mark H. Harris wrote: > On Monday, March 3, 2014 11:23:13 AM UTC-6, Wolfgang Maier wrote: Wolfgang, answer is not so much, in fact, not at all. But it is an interesting question for me; where I am continuing to learn the limits of Decimal, and the dec

Re: Reference

2014-03-03 Thread Ben Finney
Rustom Mody writes: > Short answer: Avoid using 'is'. This is bad advice in a Python forum. The ‘is’ operator is commonly used in Python, so please don't advise against it in an unqualified “short answer”. > Long answer: > http://www.beyondwilber.ca/healing-thinking/non-identity-korzybski.ht

Re: modification time in Python - Django: datetime != datetime :-(

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 7:22 AM, donarb wrote: > You're using the months format '%m' when you should be using minutes '%M'. Heh! I didn't even notice that. When I tested it, I didn't use strftime at all, just looked at gmtime's output. ChrisA -- https://mail.python.org/mailman/listinfo/python-li

Re: modification time in Python - Django: datetime != datetime :-(

2014-03-03 Thread Ben Finney
Jaap van Wingerde writes: > >>> time.strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime('/var/django/test2/art/templates/art_index.html'))) > >>> > '2014-03-02T19:03:55Z' > >>> quit() > jaap@liakoster:~$ ls --full-time > /var/django/test2/art/templates/art_index.html > -rwxrwx--- 1 lia w

Re: pip and distutils2-1.0a4

2014-03-03 Thread Mark Lawrence
On 03/03/2014 20:10, Mark H. Harris wrote: hi folks, I am having a fit with pip this afternoon. I finally got pip installed on this system from a binary blob (what nightmare, talk about 1987). Anyway, pip is installed, but when I go to PyPI to pull down distutils is gives a message that no such

Re: modification time in Python - Django: datetime != datetime :-(

2014-03-03 Thread donarb
On Monday, March 3, 2014 6:28:21 AM UTC-8, Jaap van Wingerde wrote: > Op schreef Chris Angelico > in bericht > : > > > See if ls is actually giving you ctime rather than mtime - compare the > > results if you ask for os.path.getctime. > > jaap@liakoster:~$ python > Python 2.7.3 (default, Jan

pip and distutils2-1.0a4

2014-03-03 Thread Mark H. Harris
hi folks, I am having a fit with pip this afternoon. I finally got pip installed on this system from a binary blob (what nightmare, talk about 1987). Anyway, pip is installed, but when I go to PyPI to pull down distutils is gives a message that no such package exists. I feel like Obeewan; "i

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 11:23:13 AM UTC-6, Wolfgang Maier wrote: > def fact(x): > """ fact(x)factorial{x} int x > 0 > > return +Decimal(math.factorial(x)) > to make it return a Decimal rounded to context precision? hi Wolfgang, I'm not sure. We're doing some things wit

Re: 3.4rc2 and pip on windows

2014-03-03 Thread Mark Lawrence
On 03/03/2014 00:07, Terry Reedy wrote: On 3/2/2014 6:55 PM, Mark Lawrence wrote: Trying to install pyttsx, it doesn't strike me as very clever that, as seen below, you get "Successfully installed pyttsx" despite the syntax errors and you can't actually do an import. c:\Users\Mark\CrossCode>c:\

Re: Reference

2014-03-03 Thread Terry Reedy
On 3/3/2014 4:42 AM, ast wrote: Consider following code: A=7 B=7 A is B The 'is' operator has three uses, two intended and one not. In production code, 'is' tests that an object *is* a particular singular object, such as None or a sentinel instance of class object. In test code, 'is' can

Re: Password validation security issue

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 3:46 AM, Steven D'Aprano wrote: > On Tue, 04 Mar 2014 00:55:45 +1100, Chris Angelico wrote: > >> But it's an attack vector that MUST be considered, which is why I never >> tell the truth in any "secret question / secret answer" boxes. Why some >> sites think "mother's maiden

Re: Origin of 'self'

2014-03-03 Thread Terry Reedy
On 3/3/2014 1:16 AM, Westley Martínez wrote: I understand that in an object method the first argument in the object itself, called self. However, it doesn't have to be called self, and can be called anything. So my question is why is it called self and not this like from C++ and Java. It's kin

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 4:27 AM, Steven D'Aprano wrote: > On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote: > >> This is why it's tricky to put rules in based on type inference. The >> programmer's intent isn't in the picture. > > Of course it is. If I assign 23 to variable x, that signals

Re: Password validation security issue

2014-03-03 Thread Steven D'Aprano
On Mon, 03 Mar 2014 08:41:10 -0500, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> The greatest threats these days are from the network, not from someone >> physically walking into an office. (That said, though, the low-hanging >> fruit from walking into an office can be *extremel

Re: Functional programming

2014-03-03 Thread Steven D'Aprano
On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote: > This is why it's tricky to put rules in based on type inference. The > programmer's intent isn't in the picture. Of course it is. If I assign 23 to variable x, that signals my intent to assign an int to x. By Occam's razor, it is reaso

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Wolfgang Maier
Am Montag, 3. März 2014 12:34:30 UTC+1 schrieb Mark H. Harris: > hi folks, > > > > Python Decimal Library dmath.py v0.3 Released > > > > https://code.google.com/p/pythondecimallibrary/ > > > > This code provides the C accelerated decimal module with > > scientific/transcendental function

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 10:44:16 AM UTC-6, Oscar Benjamin wrote: > Is it on PyPI though? I was referring to a PyPI name so that people > could install it with "pip install pdeclib" > Oscar hi Oscar, I'm sorry, I completely missed the point of your question. No its not on PyPI, but I don't mind

Re: Password validation security issue

2014-03-03 Thread Steven D'Aprano
On Tue, 04 Mar 2014 00:55:45 +1100, Chris Angelico wrote: > But it's an attack vector that MUST be considered, which is why I never > tell the truth in any "secret question / secret answer" boxes. Why some > sites think "mother's maiden name" is at all safe is beyond my > comprehension. And that's

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Oscar Benjamin
On 3 March 2014 15:22, Mark H. Harris wrote: > On Monday, March 3, 2014 7:34:40 AM UTC-6, Oscar Benjamin wrote: >> On 3 March 2014 11:34, Mark H. Harris wrote: >> >> Is this available on PyPI? > > Python3.3 Decimal Library v0.3 is Released here: > > https://code.google.com/p/pythondecimallibra

Re: Password validation security issue

2014-03-03 Thread MRAB
On 2014-03-03 13:55, Chris Angelico wrote: On Tue, Mar 4, 2014 at 12:41 AM, Roy Smith wrote: I used to work at which had a typical big company IT department which enforced all sorts of annoying pseudo-security rules. As far as I could figure out, however, all you needed to get them to reset an

Re: How to create a voting website by Python and Flask?

2014-03-03 Thread David Froger
Quoting Harry Wood (2014-03-03 16:22:22) > How to create a voting website by Python and Flask? I studying Python and > Flask for some months, and > > - Now I have some Python & Flask basic skills. > - I need some advices like following example: > Step 1: You could writing an voting application

Re: Reference

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 3:12:30 PM UTC+5:30, ast wrote: > hello > Consider following code: > >>> A=7 > >>> B=7 > >>> A is B > True > I understand that there is a single object 7 somewhere in memory and > both variables A and B point toward this object 7 > now do the same with a list: > >>> l1

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 8:31:47 PM UTC+5:30, Chris Angelico wrote: > On Tue, Mar 4, 2014 at 1:38 AM, Rustom Mody wrote: > > If you want the (semantic) equivalent of python's [1,2,'foo'] > > you need to make an explicit union Int and String and its that > > *single* union type's elements that must

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 7:34:40 AM UTC-6, Oscar Benjamin wrote: > On 3 March 2014 11:34, Mark H. Harris wrote: > > Is this available on PyPI? It seems there already is a "dmath" package > on PyPI that was written by someone else some time ago so you might > need to use a different name: > Osc

How to create a voting website by Python and Flask?

2014-03-03 Thread Harry Wood
How to create a voting website by Python and Flask? I studying Python and Flask for some months, and - Now I have some Python & Flask basic skills. - I need some advices like following example: Step 1: You could writing an voting application by Python Step 2: You could build a website by Flas

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 1:38 AM, Rustom Mody wrote: > If you want the (semantic) equivalent of python's [1,2,'foo'] > you need to make an explicit union Int and String and its that > *single* union type's elements that must go in. > > In all cases its always a single type. And so > sum([1,2,[3]) O

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 7:53:01 PM UTC+5:30, Chris Angelico wrote: > On Tue, Mar 4, 2014 at 1:08 AM, Rustom Mody wrote: > >> How do you know that [1,2] is a list that must contain nothing but > >> integers? By extension, it's also a list that must contain positive > >> integers less than three, so

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Mark H. Harris
On Monday, March 3, 2014 7:34:40 AM UTC-6, Oscar Benjamin wrote: > Python Decimal Library dmathlib.py v0.3 Released > https://code.google.com/p/pythondecimallibrary/ > Is this available on PyPI? It seems there already is a "dmath" package > on PyPI that was written by someone else some time ago

Re: Reference

2014-03-03 Thread Grant Edwards
On 2014-03-03, ast wrote: > hello > > Consider following code: > A=7 B=7 A is B > True > > I understand that there is a single object 7 somewhere in memory Maybe, maybe not. Integer are immutable, so that's allowed but not required. In CPython, that's true for small integers, but

Re: modification time in Python - Django: datetime != datetime :-(

2014-03-03 Thread Jaap van Wingerde
Op schreef Chris Angelico in bericht : > See if ls is actually giving you ctime rather than mtime - compare the > results if you ask for os.path.getctime. jaap@liakoster:~$ python Python 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "licen

Re: [OT] Can global variable be passed into Python function?

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 1:18 AM, Grant Edwards wrote: >> Note that, technically, Grant is correct as long as you grant (heh) >> that a structure may have an invisible member, the virtual function >> table pointer. C++ only (I don't believe C has virtual functions - >> but it may have grown them in

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 1:08 AM, Rustom Mody wrote: >> How do you know that [1,2] is a list that must contain nothing but >> integers? By extension, it's also a list that must contain positive >> integers less than three, so adding [5] violates that. And [] is a >> list that must contain nothing, e

  1   2   >