Re: checking if a list is empty

2011-05-12 Thread Ben Finney
Hans Georg Schaathun writes: > On Wed, 11 May 2011 20:31:45 -0700 (PDT), alex23 >wrote: > : On May 12, 7:24 am, harrismh777 wrote: > : > We need to move away from 'canned apps' to a new day where > : > the masses can sit down to their computer and solve new problems with it > : > through in

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Thu, 12 May 2011 16:46:38 +1000, Ben Finney wrote: : Hans Georg Schaathun writes: : : > On Wed, 11 May 2011 20:31:45 -0700 (PDT), alex23 : >wrote: : > : On May 12, 7:24 am, harrismh777 wrote: : > : > We need to move away from 'canned apps' to a new day where : > : > the masses can si

Re: checking if a list is empty

2011-05-12 Thread Ben Finney
Hans Georg Schaathun writes: > On Thu, 12 May 2011 16:46:38 +1000, Ben Finney >wrote: > : Hans Georg Schaathun writes: > : > : > On Wed, 11 May 2011 20:31:45 -0700 (PDT), alex23 > : >wrote: > : > : On May 12, 7:24 am, harrismh777 wrote: > : > : > We need to move away from 'canned app

Re: Python Developers with 5 years of experience

2011-05-12 Thread John Nagle
On 5/4/2011 10:32 AM, Jerome jjcpl.rpo wrote: send resumes to jer...@jjcpl.net One of our client in New Jersey is looking for Python Developers with 5 years of experience. If you have any resumes please send it across. Very strange recruiting organization. Strong Christian religious ori

Re: unicode by default

2011-05-12 Thread John Machin
On Thu, May 12, 2011 4:31 pm, harrismh777 wrote: > > So, the UTF-16 UTF-32 is INTERNAL only, for Python NO. See one of my previous messages. UTF-16 and UTF-32, like UTF-8 are encodings for the EXTERNAL representation of Unicode characters in byte streams. > I also was not aware that UTF-8 chars

Re: lightweight way to create new projects from templates

2011-05-12 Thread Jonathan Hartley
Hey Chris, Thanks for the thoughts. I must confess I had already given up on a 'single file' approach, because I want to make it easy for people to create their own templates, so I have to handle copying a template defined by creating a new directory full of diles. If I'm already handling this

Re: urllib2 request with binary file as payload

2011-05-12 Thread Michiel Sikma
> > 2.6 is expecting a string, according to the above. No mention of file. > Moreover it expects the data to be urlencoded. 2.7.1 docs say the same > thing. Are you sure you have shown the code that worked with 2.6? > > > -- > http://mail.python.org/mailman/listinfo/python-list > Yes, in fact I si

Re: NewBie Doubt in Python Thread Programming

2011-05-12 Thread Chris Angelico
On Thu, May 12, 2011 at 3:35 PM, vijay swaminathan wrote: > I tried using QThread as well.. But the problem is, on the run method when i > invoke the command prompt, it sends out the finished signal...  I want it to > send out the finished signal only on closing the command prompt that is > invoke

Re: NewBie Doubt in Python Thread Programming

2011-05-12 Thread vijay swaminathan
Hi Chris, I tried using os.system as well but it did not even open up the command prompt. Can you please share the code that worked for you.. just wondering if I'm missing something very basic. Regards, -Vijay Swaminathan., On Thu, May 12, 2011 at 1:38 PM, Chris Angelico wrote: > On Thu, May

Re: Need Assistance on this program.

2011-05-12 Thread vijay swaminathan
I tried using that as well. The problem is, the thread becomes dead as soon as it executes the invocation of command prompt. I want the thread to be alive till I go and manually close the command prompt. -Vijay Swaminathan. On Thu, May 12, 2011 at 2:46 PM, Andrea Crotti wrote: > vijay swaminat

Re: Need Assistance on this program.

2011-05-12 Thread Andrea Crotti
vijay swaminathan writes: > Hi All, > > I'm new bie to python thread programming and would like to assistance > on the attached code. > > In this, I'm calling a thread to invoke a command prompt and would > like to print the "Thread as alive" as long as the command prompt is > opened and would li

Re: Need Assistance on this program.

2011-05-12 Thread Tim Golden
On 12/05/2011 10:45, vijay swaminathan wrote: I tried using that as well. The problem is, the thread becomes dead as soon as it executes the invocation of command prompt. Can you post the code you're using, please? This should be simple so maybe you've misunderstood something in the threading

Re: Need Assistance on this program.

2011-05-12 Thread vijay swaminathan
Hi Tim, I have already done that. But for some reason my response went as a new thread. Attaching the code again. On Thu, May 12, 2011 at 3:38 PM, Tim Golden wrote: > On 12/05/2011 10:45, vijay swaminathan wrote: > >> >> I tried using that as well. >> The problem is, the thread becomes dead as s

Re: Need Assistance on this program.

2011-05-12 Thread Tim Golden
On 12/05/2011 11:29, vijay swaminathan wrote: <... snippet from code ...> print 'Invoking Command Promptt..' #subprocess.call(["start", "/DC:\\PerfLocal_PAL", "scripts_to_execute.bat"], shell=True) subprocess.call(["start", "C:\\windows\\system32\\cmd.exe"], shell

Re: NewBie Doubt in Python Thread Programming

2011-05-12 Thread Chris Angelico
On Thu, May 12, 2011 at 7:42 PM, vijay swaminathan wrote: > Hi Chris, > > I tried using os.system as well but it did not even open up the command > prompt. > > Can you please share the code that worked for you.. just wondering if I'm > missing something very basic. Caveat: I'm not using Qt, I jus

Slice implementation bug

2011-05-12 Thread Tambet
Hello! Let's say slice is multidimensional now - how to interpret it? I excpect these to work: - m[0, 3] - get one element from matrix - m[0:2, 0:2] - get four elements from matrix, iterate over them (I have actually an rtree if it doesn't make sense to you) But it won't, because if m[

Re: checking if a list is empty

2011-05-12 Thread Roy Smith
In article <931adaf9g...@mid.individual.net>, Gregory Ewing wrote: > Roy Smith wrote: > >>If both are numbers, they are converted to a common type. Otherwise, > >>objects of different types always compare unequal > > That's just the default treatment for unrelated types that don't > know anyth

Re: Slice implementation bug

2011-05-12 Thread Andrea Crotti
Tambet writes: > Hello! > > Let's say slice is multidimensional now - how to interpret it? > But who said that slice is multidimensional in the first place? Since python is not matlab I don't think it will ever be done, so what's the purpose of talking about a bug in something that doesn't exis

Re: checking if a list is empty

2011-05-12 Thread Chris Angelico
On Thu, May 12, 2011 at 4:21 PM, Hans Georg Schaathun wrote: > On Thu, 12 May 2011 01:49:05 -0400, D'Arcy J.M. Cain >   wrote: > :  That's not programming.  That's using a canned app that a programmer > :  wrote that takes your unstructured input and does something useful with > :  it.  Spreadshe

list equal to subclass of list?

2011-05-12 Thread Roy Smith
I have a vague feeling this may have been discussed a long time ago, but I can't find the thread, so I'll bring it up again. I recently observed in the "checking if a list is empty" thread that a list and a subclass of list can compare equal: class MyList(list):

Re: unicode by default

2011-05-12 Thread TheSaint
John Machin wrote: > On Thu, May 12, 2011 2:14 pm, Benjamin Kaplan wrote: >> >> If the file you're writing to doesn't specify an encoding, Python will >> default to locale.getdefaultencoding(), > > No such attribute. Perhaps you mean locale.getpreferredencoding() what about sys.getfilesystemenco

Re: checking if a list is empty

2011-05-12 Thread Hans Georg Schaathun
On Thu, 12 May 2011 22:16:10 +1000, Chris Angelico wrote: : Anyone can join. Not everyone wants to join. Me, I'm happy here as a : priest of the software industry, and I have no desire to become a : priest of, say, automotive engineering or concrete pouring. Would an : expert concreter be ex

generate properties code in class dynamically

2011-05-12 Thread JamesEM
Hello, I have a python class that contains a dictionary. I would like to use python properties to access the elements of the dictionary. This could be achieved as follows: class MyClass(object): def __init__(self): self.d = {} d['field1'] = 1.0 d['field2'] = 'A'

Re: checking if a list is empty

2011-05-12 Thread Chris Angelico
On Thu, May 12, 2011 at 10:43 PM, Hans Georg Schaathun wrote: > On Thu, 12 May 2011 22:16:10 +1000, Chris Angelico >   wrote: > :  Anyone can join. Not everyone wants to join. Me, I'm happy here as a > :  priest of the software industry, and I have no desire to become a > :  priest of, say, autom

Re: py3k buffered IO - flush() required between read/write?

2011-05-12 Thread Genstein
With 3.2 on winxp, that is what I get with StringIO, text file, and bytes file (the first two with b's removed). I would expect the same on any system. If you get anything different, I would consider it a bug Thanks Terry, you're entirely right there; I trimmed down my test case, asked for conf

Customize help output from optparse (or argparse)

2011-05-12 Thread Thorsten Kampe
Hi, I'm using optparse for a little Python script. 1. The output from "--help" is: """ Usage: script.py script.py does something Options: -h, --help show this help message and exit """ I would prefer to have the description before the usage, like... """ script.py does something Usage: s

Re: list equal to subclass of list?

2011-05-12 Thread Algis Kabaila
On Thursday 12 May 2011 22:23:04 Roy Smith wrote: > I have a vague feeling this may have been discussed a long > time ago, but I can't find the thread, so I'll bring it up > again. > > I recently observed in the "checking if a list is empty" > thread that a list and a subclass of list can compare

Re: checking if a list is empty

2011-05-12 Thread Ethan Furman
Chris Angelico wrote: On Thu, May 12, 2011 at 7:02 AM, Ian wrote: In the "real world" lists of zero items do not exist. You don't go shopping with a shopping list of zero items. Actually, yes you do. You maintain your shopping list between trips; whenever you need something, you put it on th

os.popen command working differently on Windows

2011-05-12 Thread Ayaskanta Swain
Hi All, Please help me in solving the following issue I am facing while executing my python script. Basically I am executing the OS specific move command to move a file/dir from one location to another. I am executing the 'mv' command on linux & the 'move' DOS command on windows machine from my

Re: checking if a list is empty

2011-05-12 Thread Chris Angelico
On Fri, May 13, 2011 at 12:02 AM, Ethan Furman wrote: > Chris Angelico wrote: >> >> On Thu, May 12, 2011 at 7:02 AM, Ian wrote: >>> >>> In the "real world"  lists of zero items do not exist. >>> You don't go shopping with a shopping list of zero items. >> >> Actually, yes you do. You maintain you

Re: generate properties code in class dynamically

2011-05-12 Thread nn
On May 12, 9:11 am, JamesEM wrote: > Hello, > I have a python class that contains a dictionary. > I would like to use python properties to access the elements of the > dictionary. > This could be achieved as follows: > > class MyClass(object): > >     def __init__(self): >         self.d = {} >  

Re: os.popen command working differently on Windows

2011-05-12 Thread Tim Golden
On 12/05/2011 15:11, Ayaskanta Swain wrote: Please help me in solving the following issue I am facing while executing my python script. Basically I am executing the OS specific move command to move a file/dir from one location to another. Why? Why not use os.rename or shutil.move which already

Re: os.popen command working differently on Windows

2011-05-12 Thread MRAB
On 12/05/2011 15:11, Ayaskanta Swain wrote: Hi All, Please help me in solving the following issue I am facing while executing my python script. Basically I am executing the OS specific move command to move a file/dir from one location to another. I am executing the ‘mv’ command on linux & the ‘m

urllib2.urlopen+BadStatusLine+https

2011-05-12 Thread up2date.cyborg
Hi, I am new to this list, I don't really know if I should post here my request. Anyway. The following code is raising httplib.BadStatusLine on urllib2.urlopen(url) url = 'https://stat.netaffiliation.com/requete.php?login=xxx&mdp=yyy&debut=2011-05-01&fin=2011-05-12' response = urllib2.urlopen(

Python 2.7 Debian 6.0. Squeeze

2011-05-12 Thread Jorge Romero
Hi all, My machine is running Debian Squeeze so my default Python runtime is 2.6.6. According to Python docs *optparse* library is deprecated and the development will be moved to *argparse*, which is new in Python 2.7.1. So now that I'm about to write a script that parse command line arguments th

Re: list equal to subclass of list?

2011-05-12 Thread Eric Snow
On Thu, May 12, 2011 at 6:23 AM, Roy Smith wrote: > I have a vague feeling this may have been discussed a long time ago, but > I can't find the thread, so I'll bring it up again. > > I recently observed in the "checking if a list is empty" thread that a > list and a subclass of list can compare e

Re: can't get urllib2 or httplib to work with tor & privoxy

2011-05-12 Thread Bob Fnord
Chris Angelico wrote: > On Tue, May 10, 2011 at 4:20 AM, Bob Fnord wrote: > > Both methods give me a 503 error... > > As a networking geek, my first thought would be to fire up a tiny > little "snoop server" and see what, exactly, the two methods are > doing. (Ignore the HTTPS options as they'r

Re: Python 2.7 Debian 6.0. Squeeze

2011-05-12 Thread Jorge Romero
Actually came back with some feedback to my own question. The following repositories do the job: # /etc/apt/sources.list deb http://ftp.uk.debian.org/debian/ unstable main contrib non-free deb http://ftp.uk.debian.org/debian/ experimental main contrib non-free deb http://security.debian.org/ test

Python enabled gdb on Windows and relocation

2011-05-12 Thread Ruben Van Boxem
Hi, I am currently trying to integrate Python support into my toolchain build (including GDB of course). It is a sysrooted binutils+GCC+GDB+mingw-w64 toolchain. I currently have the basic setup working: I can link gdb with my manually generated import lib to the python dll from the official Windo

Re: unicode by default

2011-05-12 Thread Ian Kelly
On Thu, May 12, 2011 at 1:58 AM, John Machin wrote: > On Thu, May 12, 2011 4:31 pm, harrismh777 wrote: > >> >> So, the UTF-16 UTF-32 is INTERNAL only, for Python > > NO. See one of my previous messages. UTF-16 and UTF-32, like UTF-8 are > encodings for the EXTERNAL representation of Unicode charac

Python enabled gdb on Windows and relocation

2011-05-12 Thread Ruben Van Boxem
(now in plain-text as required by gdb mailing list) Hi, I am currently trying to integrate Python support into my toolchain build (including GDB of course). It is a sysrooted binutils+GCC+GDB+mingw-w64 toolchain. I currently have the basic setup working: I can link gdb with my manually generated

Re: list equal to subclass of list?

2011-05-12 Thread Roy Smith
On May 12, 2011, at 11:30 AM, Eric Snow wrote: > On Thu, May 12, 2011 at 6:23 AM, Roy Smith wrote: > The docs say: > > [http://docs.python.org/library/stdtypes.html] > Objects of different types, except different numeric types and different > string types, never compare equal > > [http://docs.p

Re: list equal to subclass of list?

2011-05-12 Thread Ethan Furman
Roy Smith wrote: I recently observed in the "checking if a list is empty" thread that a list and a subclass of list can compare equal: class MyList(list): "I'm a subclass" l1 = [] l2 = MyList() print type(l1), type(l2) print type(l1) == type(l2) print l1 == l2

Re: Slice implementation bug

2011-05-12 Thread Robert Kern
On 5/12/11 6:06 AM, Tambet wrote: Hello! Let's say slice is multidimensional now - how to interpret it? I excpect these to work: * m[0, 3] - get one element from matrix * m[0:2, 0:2] - get four elements from matrix, iterate over them (I have actually an rtree if it doesn't make s

Re: checking if a list is empty

2011-05-12 Thread ru...@yahoo.com
On 05/12/2011 12:13 AM, Steven D'Aprano wrote: >[snip] > http://www.codinghorror.com/blog/2006/07/separating-programming-sheep-from-non-programming-goats.html > > Shorter version: it seems that programming aptitude is a bimodal > distribution, with very little migration from the "can't program" hum

Re: list equal to subclass of list?

2011-05-12 Thread Ethan Furman
Roy Smith wrote: On May 12, 2011, at 11:30 AM, Eric Snow wrote: That definitely makes it unclear. I don't think it's unclear at all. It's very clear. Clearly wrong :-) While it is wrong (it should have 'built-in' precede the word 'types'), it is not wrong in the way you think -- a subcla

Re: Proper way to handle errors in a module

2011-05-12 Thread Andrew Berg
On 2011.05.11 01:05 PM, Roy Smith wrote: > You want to raise specific errors. Let's say you've got a function like > this: > > def airspeed(swallow): >speeds = {"european": 42, > "african", 196} >return speeds[swallow] > > If somebody passes an invalid string, it will raise K

Hi all. I need aid in creating script to blender.

2011-05-12 Thread Jean Carlos Páez Ramírez
Hello. The attached file is script of blender fact in python that .tmb serves to concern archives (secondly attached file), unloadings to blender and uses script and concerns the second file that you shipment you see so that it. Everything can be published and, but it is not possible to be exp

Re: Me ayudas? Hi . I need aid in creating script to blender.

2011-05-12 Thread Felipe Vinturini
2011/5/12 Jean Carlos Páez Ramírez > Hello. > > The attached file is script of blender fact in python that .tmb serves to > concern archives (secondly attached file), unloadings to blender and uses > script and concerns the second file that you shipment you see so that it. > Everything can be pu

Re: Proper way to handle errors in a module

2011-05-12 Thread MRAB
On 12/05/2011 20:14, Andrew Berg wrote: On 2011.05.11 01:05 PM, Roy Smith wrote: You want to raise specific errors. Let's say you've got a function like this: def airspeed(swallow): speeds = {"european": 42, "african", 196} return speeds[swallow] If somebody passes an in

Re: Me ayudas? Hi . I need aid in creating script to blender.

2011-05-12 Thread Felipe Vinturini
2011/5/12 Jean Carlos Páez Ramírez > To ok there is no problem friend, of all ways thanks, I will see that I > can do, nor in the pages Web of blender they answer to me. > > Thanks friend. > > Regads, > > Jean P. > > -- > From: felipe.vintur...@gmail.com > Date: Thu,

Re: checking if a list is empty

2011-05-12 Thread Terry Reedy
On 5/11/2011 8:26 AM, Roy Smith wrote: I conclude that li == [] should have returned False. Either I'm not understanding things correctly, or this is a bug. The doc is wrong (and not only on this). I am working on a report with suggested fixes. Will post number when finish. -- Terry Jan Re

Re: py3k buffered IO - flush() required between read/write?

2011-05-12 Thread Terry Reedy
On 5/12/2011 9:30 AM, Genstein wrote: With 3.2 on winxp, that is what I get with StringIO, text file, and bytes file (the first two with b's removed). I would expect the same on any system. If you get anything different, I would consider it a bug Thanks Terry, you're entirely right there; I tri

Re: generate properties code in class dynamically

2011-05-12 Thread Terry Reedy
On 5/12/2011 9:11 AM, JamesEM wrote: I would prefer to generate the properties code dynamically from the keys of the dictionaries. What I am looking for is something like: class MyClass(object): def __init__(self): self.d = {} d['field1'] = 1.0 d['field2'] = 'A'

Re: Proper way to handle errors in a module

2011-05-12 Thread Andrew Berg
On 2011.05.12 02:25 PM, MRAB wrote: > You can raise an exception wherever you like! :-) If I raise an exception that isn't a built-in exception, I get something like "NameError: name 'HelloError' is not defined". I don't know how to define the exception. -- http://mail.python.org/mailman/listinfo/

Re: Customize help output from optparse (or argparse)

2011-05-12 Thread Thomas 'PointedEars' Lahn
Thorsten Kampe wrote: > I'm using optparse for a little Python script. > > 1. The output from "--help" is: > """ > Usage: script.py > > script.py does something > > Options: > -h, --help show this help message and exit > """ > > I would prefer to have the description before the usage, lik

Re: Proper way to handle errors in a module

2011-05-12 Thread Corey Richardson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/12/2011 04:12 PM, Andrew Berg wrote: > On 2011.05.12 02:25 PM, MRAB wrote: >> You can raise an exception wherever you like! :-) > If I raise an exception that isn't a built-in exception, I get something > like "NameError: name 'HelloError' is not

Re: Proper way to handle errors in a module

2011-05-12 Thread Tycho Andersen
On Thu, May 12, 2011 at 03:12:39PM -0500, Andrew Berg wrote: > On 2011.05.12 02:25 PM, MRAB wrote: > > You can raise an exception wherever you like! :-) > If I raise an exception that isn't a built-in exception, I get something > like "NameError: name 'HelloError' is not defined". I don't know how

Re: Proper way to handle errors in a module

2011-05-12 Thread MRAB
On 12/05/2011 21:12, Andrew Berg wrote: On 2011.05.12 02:25 PM, MRAB wrote: You can raise an exception wherever you like! :-) If I raise an exception that isn't a built-in exception, I get something like "NameError: name 'HelloError' is not defined". I don't know how to define the exception.

Re: Proper way to handle errors in a module

2011-05-12 Thread Ethan Furman
Andrew Berg wrote: On 2011.05.12 02:25 PM, MRAB wrote: You can raise an exception wherever you like! :-) If I raise an exception that isn't a built-in exception, I get something like "NameError: name 'HelloError' is not defined". I don't know how to define the exception. class HelloError(Exce

Re: Proper way to handle errors in a module

2011-05-12 Thread Andrew Berg
On 2011.05.12 03:20 PM, Corey Richardson wrote: > class HelloError(Exception): > pass > > Of course, there are all sorts of other things you could do with your > exception. > > http://docs.python.org/tutorial/errors.html#user-defined-exceptions So that's where that info is. I wasn't looking in

Re: py3k buffered IO - flush() required between read/write?

2011-05-12 Thread Genstein
On 12/05/2011 20:44, Terry Reedy wrote: I want people to know that with a simple, minimal, easy to run and reproduce and think about test case posted, more info, more test cases, and probable fixes were posted within an hour. (Fixes are not always that quick, but stripping away irrelevancies real

Re: Customize help output from optparse (or argparse)

2011-05-12 Thread Karim
On 05/12/2011 10:22 PM, Thomas 'PointedEars' Lahn wrote: Thorsten Kampe wrote: I'm using optparse for a little Python script. 1. The output from "--help" is: """ Usage: script.py script.py does something Options: -h, --help show this help message and exit """ I would prefer to have the

Re: unicode by default

2011-05-12 Thread Terry Reedy
On 5/12/2011 12:17 PM, Ian Kelly wrote: On Thu, May 12, 2011 at 1:58 AM, John Machin wrote: On Thu, May 12, 2011 4:31 pm, harrismh777 wrote: So, the UTF-16 UTF-32 is INTERNAL only, for Python NO. See one of my previous messages. UTF-16 and UTF-32, like UTF-8 are encodings for the EXTERNAL

Re: list equal to subclass of list?

2011-05-12 Thread Thomas 'PointedEars' Lahn
Ethan Furman wrote: > PS > I have a broken sense of humor -- sometimes it works, sometimes it > doesn't. My apologies in advance if my attempt at humor was not funny. Now that was very unpythonic. Know where your roots are! :) -- PointedEars Bitte keine Kopien per E-Mail. / Please do not Cc:

Re: Need Assistance on this program.

2011-05-12 Thread Thomas 'PointedEars' Lahn
vijay swaminathan wrote: > I have already done that. But for some reason my response went > as a new thread. Attaching the code again. JFYI: Please DO NOT post attachments in a non-binary newsgroup or to a mailing list (are there binary ones at all?) again. TIA. -- PointedEars Bitte keine Kop

Re: list equal to subclass of list?

2011-05-12 Thread Roy Smith
On May 12, 2:29 pm, Ethan Furman wrote: > While it is wrong (it should have 'built-in' precede the word 'types'), > it is not wrong in the way you think -- a subclass *is* a type of its > superclass. Well, consider this: class List_A(list): "A list subclass" class List_B(list): "Anothe

Re: list equal to subclass of list?

2011-05-12 Thread Ethan Furman
Roy Smith wrote: On May 12, 2:29 pm, Ethan Furman wrote: While it is wrong (it should have 'built-in' precede the word 'types'), it is not wrong in the way you think -- a subclass *is* a type of its superclass. Well, consider this: class List_A(list): "A list subclass" class List_B(lis

Re: checking if a list is empty

2011-05-12 Thread Terry Reedy
On 5/12/2011 3:37 PM, Terry Reedy wrote: On 5/11/2011 8:26 AM, Roy Smith wrote: I conclude that li == [] should have returned False. Either I'm not understanding things correctly, or this is a bug. The doc is wrong (and not only on this). I am working on a report with suggested fixes. Will po

Re: unicode by default

2011-05-12 Thread Ian Kelly
On Thu, May 12, 2011 at 2:42 PM, Terry Reedy wrote: > On 5/12/2011 12:17 PM, Ian Kelly wrote: >> Right.  *Under the hood* Python uses UCS-2 (which is not exactly the >> same thing as UTF-16, by the way) to represent Unicode strings. > > I know some people say that, but according to the definitions

Re: Python 2.7 Debian 6.0. Squeeze

2011-05-12 Thread Chen Wei
On Thu, May 12, 2011 at 12:03:26PM -0400, Jorge Romero wrote: > Actually came back with some feedback to my own question. > > The following repositories do the job: > # /etc/apt/sources.list > deb http://ftp.uk.debian.org/debian/ unstable main contrib non-free > deb http://ftp.uk.debian.org/debian

Peculiar Behaviour of __builtins__

2011-05-12 Thread Aman Nijhawan
I was trying to call the builtin function min by using getattr(__builtins__,'min') This works at the interpretter prompt However when I called it inside a module that was imported by another module it fails and gives an attribute error print getattr(__builtins__,'min')(range(20)) AttributeError:

Re: checking if a list is empty

2011-05-12 Thread Steven D'Aprano
On Thu, 12 May 2011 07:36:27 -0400, Roy Smith wrote: > In article <931adaf9g...@mid.individual.net>, > Gregory Ewing wrote: > >> Roy Smith wrote: >> >>If both are numbers, they are converted to a common type. Otherwise, >> >>objects of different types always compare unequal >> >> That's just t

Re: list equal to subclass of list?

2011-05-12 Thread Steven D'Aprano
On Thu, 12 May 2011 09:43:23 -0700, Ethan Furman wrote: > MyList is a list -- just a more specific kind of list -- as can be seen > from its mro; this is analogous to a square (2 sets of parallel lines > joined at 90 degree angles, both sets being the same length) also being > a rectangle (2 sets

Re: Proper way to handle errors in a module

2011-05-12 Thread Steven D'Aprano
On Thu, 12 May 2011 15:26:27 -0500, Tycho Andersen wrote: > On Thu, May 12, 2011 at 03:12:39PM -0500, Andrew Berg wrote: >> On 2011.05.12 02:25 PM, MRAB wrote: >> > You can raise an exception wherever you like! :-) >> If I raise an exception that isn't a built-in exception, I get >> something like

Re: list equal to subclass of list?

2011-05-12 Thread Ethan Furman
Steven D'Aprano wrote: On Thu, 12 May 2011 09:43:23 -0700, Ethan Furman wrote: MyList is a list -- just a more specific kind of list -- as can be seen from its mro; this is analogous to a square (2 sets of parallel lines joined at 90 degree angles, both sets being the same length) also being a

Re: Proper way to handle errors in a module

2011-05-12 Thread Ben Finney
Andrew Berg writes: > So that's where that info is. I wasn't looking in the tutorial > section. Does this mean you haven't worked through the tutorial? Time to remedy that. -- \ “You are welcome to visit the cemetery where famous Russian and | `\Soviet composers, artists, and writer

Re: list equal to subclass of list?

2011-05-12 Thread Roy Smith
In article , Ethan Furman wrote: > > [http://docs.python.org/library/stdtypes.html] > > Objects of different types, except different numeric types and different > > string types, never compare equal > > This part of the documentation is talking about built-in types, which > your MyList is not

Re: Peculiar Behaviour of __builtins__

2011-05-12 Thread Gabriel Genellina
En Thu, 12 May 2011 20:29:57 -0300, Aman Nijhawan escribió: I was trying to call the builtin function min by using getattr(__builtins__,'min') This works at the interpretter prompt However when I called it inside a module that was imported by another module it fails and gives an attribut

Re: Peculiar Behaviour of __builtins__

2011-05-12 Thread Gabriel Genellina
En Thu, 12 May 2011 22:59:24 -0300, Gabriel Genellina escribió: En Thu, 12 May 2011 20:29:57 -0300, Aman Nijhawan escribió: I was trying to call the builtin function min by using getattr(__builtins__,'min') This works at the interpretter prompt However when I called it inside a module

Re: Non Programming in python

2011-05-12 Thread Rustom Mody
On Wed, May 11, 2011 at 5:57 PM, Calvin Spealman wrote: > If this is the "non-programming side of python" then maybe some of us have > a lacking definition of what "programming" is. My mechanic stilll has to > check the tire pressure and I need to update the version number in PyPI. > O well you

Re: Need Assistance on this program.

2011-05-12 Thread vijay swaminathan
Hi Tim., Thanks.. This works as I had expected. are there any documentation for the subprocess.call method? I tried going through the python doc but could not narrow down. I just wanted to know how do I pass an arguement after invoking the command prompt? Any thoughts on this pls? On Thu, May

Re: generate properties code in class dynamically

2011-05-12 Thread JamesEM
On May 12, 10:04 pm, Terry Reedy wrote: > On 5/12/2011 9:11 AM, JamesEM wrote: > > > > > I would prefer to generate the properties code dynamically from the > > keys of the dictionaries. > > What I am looking for is something like: > > > class MyClass(object): > > >      def __init__(self): > >  

Re: unicode by default

2011-05-12 Thread jmfauth
On 12 mai, 18:17, Ian Kelly wrote: > ... > to worry about encodings are when you're encoding unicode characters > to byte strings, or decoding bytes to unicode characters A small but important correction/clarification: In Unicode, "unicode" does not encode a *character*. It encodes a *code poi

Re: checking if a list is empty

2011-05-12 Thread rusi
Mathematics has existed for millenia. Hindu-arabic numerals (base-10 numbers) have been known for about one millennium The boolean domain is only a 100 years old. Unsurprisingly it is not quite 'first-class' yet: See http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html [Lifted fro