Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Chris Angelico
On Thu, Apr 26, 2012 at 3:48 PM, John Nagle wrote: >   This assumes that everything is, internally, an object.  In CPython, > that's the case, because Python is a naive interpreter and everything, > including numbers, is "boxed".  That's not true of PyPy or Shed Skin. > So does "is" have to force

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread John Nagle
On 4/25/2012 5:01 PM, Steven D'Aprano wrote: On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: Though, maybe it's better to use a different keyword than 'is' though, due to the plain English connotations of the term; I like 'sameobj' personally, for whatever little it matters. Really, I th

Re: Upgrading from 2.7 to 3.x

2012-04-25 Thread Stefan Behnel
deuteros, 26.04.2012 05:08: > I'm fairly new to Python I have version 2.7 installed on my computer. However > my professor wants us all to use the latest version of Python. Did he/she explicitly tell you to install Python 3? 2.7 is the latest version of Python 2.x, some people may mix that up. O

Re: csv: No fields, or one field?

2012-04-25 Thread Tim Roberts
Neil Cerutti wrote: >Is there an explanation or previous dicussion somewhere for the >following behavior? I haven't yet trolled the csv mailing list >archive, though that would probably be a good place to check. > >Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit >(Intel)] on win

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Chris Angelico
On Thu, Apr 26, 2012 at 1:50 PM, Adam Skutt wrote: > On Apr 25, 8:01 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> 2) The "is" operator always has the exact same semantics and cannot be >> overridden. The id() function can be monkey-patched. > > I can't see how that's useful at a

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Adam Skutt
On Apr 25, 8:01 pm, Steven D'Aprano wrote: > On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: > > Though, maybe it's better to use a different keyword than 'is' though, > > due to the plain English > > connotations of the term; I like 'sameobj' personally, for whatever > > little it matters.

Re: Upgrading from 2.7 to 3.x

2012-04-25 Thread Xavier Ho
What operating system are you running? Cheers, Xav On 26 April 2012 13:08, deuteros wrote: > I'm fairly new to Python I have version 2.7 installed on my computer. > However > my professor wants us all to use the latest version of Python. How do I go > about upgrading? Do I just install the ne

Upgrading from 2.7 to 3.x

2012-04-25 Thread deuteros
I'm fairly new to Python I have version 2.7 installed on my computer. However my professor wants us all to use the latest version of Python. How do I go about upgrading? Do I just install the new version? Do I have to do anything with the old version already installed? -- http://mail.python.org

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Roy Smith
In article <4f9833ff$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 25 Apr 2012 13:42:31 +0200, Thomas Rachel wrote: > > > Two objects can be equal (=) without being identical (≡), but not the > > other way. > > > >>> x = float('nan') > >>> y = x > >>> x is y

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Steven D'Aprano
On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: > Though, maybe it's better to use a different keyword than 'is' though, > due to the plain English > connotations of the term; I like 'sameobj' personally, for whatever > little it matters. Really, I think taking away the 'is' operator > alto

Python 3 porting

2012-04-25 Thread Barry Warsaw
I want to take this opportunity to make folks aware of several Python 3 porting initiatives and resources. In Ubuntu 12.10, we are going to be making a big push to target all the applications and libraries on the desktop CDs to Python 3. While this is a goal of Ubuntu, the intent really is to wor

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Terry Reedy
On 4/25/2012 4:49 PM, Adam Skutt wrote: Identity and equality are distinct concepts in programming languages. There's nothing that can be done about that, and no particularly good reason to force certain language behaviors because some "programmers" have difficulty with the distinction. Though,

Re: Strange __import__() behavior

2012-04-25 Thread Terry Reedy
On 4/25/2012 4:05 PM, Frank Miles wrote: I have an exceedingly simple function that does a "named import". It works perfectly for one file "r"- and fails for the second "x". If I reverse the order of being called, it is still "x" that fails, and "r" still succeeds. os.access() always reports th

Re: Strange __import__() behavior

2012-04-25 Thread Kiuhnm
On 4/25/2012 22:05, Frank Miles wrote: I have an exceedingly simple function that does a "named import". It works perfectly for one file "r"- and fails for the second "x". If I reverse the order of being called, it is still "x" that fails, and "r" still succeeds. os.access() always reports that

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Adam Skutt
On Apr 25, 10:38 am, Nobody wrote: > On Mon, 23 Apr 2012 10:01:24 -0700, Paul Rubin wrote: > >> I can't think of a single case where 'is' is ill-defined. > > > If I can't predict the output of > > >     print (20+30 is 30+20)  # check whether addition is commutative print > >     (20*30 is 30*20)

Re: Strange __import__() behavior

2012-04-25 Thread Chris Kaynor
On Wed, Apr 25, 2012 at 1:05 PM, Frank Miles wrote: > I have an exceedingly simple function that does a "named import". > It works perfectly for one file "r"- and fails for the second "x". > > If I reverse the order of being called, it is still "x" that fails, > and "r" still succeeds. > > os.acc

Strange __import__() behavior

2012-04-25 Thread Frank Miles
I have an exceedingly simple function that does a "named import". It works perfectly for one file "r"- and fails for the second "x". If I reverse the order of being called, it is still "x" that fails, and "r" still succeeds. os.access() always reports that the file is readable (i.e. "true") If I

RE: Appending to []

2012-04-25 Thread Prasad, Ramit
> >> Then nested calls like > >> > >> a = [].append('x').append('y').append('z') > > Sequential appends are nearly always done within a loop. If not in a loop and you have multiple things already in an iterable (or create the iterable inline) you can use extend a= [] a.extend( [ 'x, 'y, 'z' ] )

Re: csv: No fields, or one field?

2012-04-25 Thread Neil Cerutti
On 2012-04-25, Kiuhnm wrote: > On 4/25/2012 20:05, Neil Cerutti wrote: >> Is there an explanation or previous dicussion somewhere for the >> following behavior? I haven't yet trolled the csv mailing list >> archive, though that would probably be a good place to check. >> >> Python 3.2 (r32:88445,

Re: csv: No fields, or one field?

2012-04-25 Thread Kiuhnm
On 4/25/2012 20:05, Neil Cerutti wrote: Is there an explanation or previous dicussion somewhere for the following behavior? I haven't yet trolled the csv mailing list archive, though that would probably be a good place to check. Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (I

csv: No fields, or one field?

2012-04-25 Thread Neil Cerutti
Is there an explanation or previous dicussion somewhere for the following behavior? I haven't yet trolled the csv mailing list archive, though that would probably be a good place to check. Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright",

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Chris Angelico
On Thu, Apr 26, 2012 at 3:27 AM, Steven D'Aprano wrote: > By the way, in mathematics, ≡ normally means "is equivalent to", which is > not quite the same as "identical to". That's perhaps because, in mathematics, nobody would even think of asking if this 4 is the same as that 4. What sort of quest

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Steven D'Aprano
On Wed, 25 Apr 2012 13:42:31 +0200, Thomas Rachel wrote: > Two objects can be equal (=) without being identical (≡), but not the > other way. >>> x = float('nan') >>> y = x >>> x is y True >>> x == y False By the way, in mathematics, ≡ normally means "is equivalent to", which is not quite the

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Nobody
On Mon, 23 Apr 2012 10:01:24 -0700, Paul Rubin wrote: >> I can't think of a single case where 'is' is ill-defined. > > If I can't predict the output of > > print (20+30 is 30+20) # check whether addition is commutative print > (20*30 is 30*20) # check whether multiplication is commutat

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Thomas Rachel
Am 24.04.2012 15:25 schrieb rusi: Identity, sameness, equality and the verb to be are all about the same concept(s) and their definitions are *intrinsically* circular; see http://plato.stanford.edu/entries/identity/#2 Mybe in real life language. In programming and mathematics there are severa

Re: Same code cause the different result.

2012-04-25 Thread Jean-Michel Pichavant
叶佑群 wrote: Hi, all I have code as: /pobj = subprocess.Popen (["smbpasswd", user], stdin =subprocess.PIPE) password += "\n" pobj.stdin.write (password) pobj.stdin.write (password)/ the command smbpasswd will change the samba user's passwor

Re: Same code cause the different result.

2012-04-25 Thread Kushal Kumaran
On Wed, Apr 25, 2012 at 12:21 PM, 叶佑群 wrote: > Hi, all > >    I have code as: > >     pobj = subprocess.Popen (["smbpasswd", user], stdin > =subprocess.PIPE) >     password += "\n" >     pobj.stdin.write (password) >     pobj.stdin.write (password) > >     the comma

ANN: eGenix mx Base Distribution 3.2.4 (mxDateTime, mxTextTools, etc.)

2012-04-25 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mx Base Distribution Version 3.2.4 for Python 2.4 - 2.7 Open Source Python extensions providing important and useful services

Re: global vars across modules

2012-04-25 Thread Thomas 'PointedEars' Lahn
John Nagle wrote: > On 4/22/2012 12:39 PM, mambokn...@gmail.com wrote: >> Question: >> How can I access to the global 'a' in file_2 without resorting to the >> whole name 'file_1.a' ? > > Actually, it's better to use the fully qualified name "file_1.a". > Using "import *" brings in everythin

python basics

2012-04-25 Thread gowtham raman
http://yellow937.webs.com/ -- http://mail.python.org/mailman/listinfo/python-list