Re: Python Gotcha's?

2012-04-05 Thread Steve Howell
On Apr 5, 10:36 pm, rusi wrote: > On Apr 6, 9:54 am, Steve Howell wrote: > > > JS, YAML, and HTML are pretty similar to Python with respect to single > > vs. double, as far as I know/remember/care. > > [Complete ignoramus here -- writing after a few minutes of googling] > > YAML:http://yaml.org/s

Re: Python Gotcha's?

2012-04-05 Thread rusi
On Apr 6, 9:54 am, Steve Howell wrote: > JS, YAML, and HTML are pretty similar to Python with respect to single > vs. double, as far as I know/remember/care. [Complete ignoramus here -- writing after a few minutes of googling] YAML: http://yaml.org/spec/current.html#single%20quoted%20style/synta

Re: escaping/encoding/formatting in python

2012-04-05 Thread rusi
On Apr 6, 10:13 am, Steve Howell wrote: > On Apr 5, 9:59 pm, rusi wrote: > > > On Apr 6, 6:56 am, Steve Howell wrote: > > > > One of the biggest nuisances for programmers, just beneath date/time > > > APIs in the pantheon of annoyances, is that we are constantly dealing > > > with escaping/encod

Re: escaping/encoding/formatting in python

2012-04-05 Thread Steve Howell
On Apr 5, 9:59 pm, rusi wrote: > On Apr 6, 6:56 am, Steve Howell wrote: > > > One of the biggest nuisances for programmers, just beneath date/time > > APIs in the pantheon of annoyances, is that we are constantly dealing > > with escaping/encoding/formatting issues. > > [OT for this list] > If yo

Re: escaping/encoding/formatting in python

2012-04-05 Thread Steve Howell
On Apr 5, 9:59 pm, rusi wrote: > On Apr 6, 6:56 am, Steve Howell wrote: > > > One of the biggest nuisances for programmers, just beneath date/time > > APIs in the pantheon of annoyances, is that we are constantly dealing > > with escaping/encoding/formatting issues. > > [OT for this list] > If yo

Re: escaping/encoding/formatting in python

2012-04-05 Thread rusi
On Apr 6, 6:56 am, Steve Howell wrote: > One of the biggest nuisances for programmers, just beneath date/time > APIs in the pantheon of annoyances, is that we are constantly dealing > with escaping/encoding/formatting issues. [OT for this list] If you run $ find /usr/share/emacs/23.3/lisp/ -name

Re: Python Gotcha's?

2012-04-05 Thread Steve Howell
On Apr 5, 9:28 pm, rusi wrote: > On Apr 5, 4:06 pm, Duncan Booth wrote: > > > Steven D'Aprano wrote: > > > JSON expects double-quote marks, not single: > > >     v = json.loads("{'test':'test'}")  fails > > >     v = json.loads('{"test":"test"}')  succeeds > > > You mean JSON expects a string wi

Re: Python Gotcha's?

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 2:28 PM, rusi wrote: > Are there languages (other than python) in which single and double > quotes are equivalent? > > [No I dont claim to know all the languages out there, just that I dont > know any other language which allows single and double quotes to be > interconverti

Re: Python Gotcha's?

2012-04-05 Thread rusi
On Apr 5, 4:06 pm, Duncan Booth wrote: > Steven D'Aprano wrote: > > JSON expects double-quote marks, not single: > >     v = json.loads("{'test':'test'}")  fails > >     v = json.loads('{"test":"test"}')  succeeds > > You mean JSON expects a string with valid JSON? > Quelle surprise. Are there l

Re: Python Gotcha's?

2012-04-05 Thread John O'Hagan
On Thu, 05 Apr 2012 10:15:03 -0400 John Posner wrote: > On 4/4/2012 7:32 PM, Chris Angelico wrote: > > Don't know if it's what's meant on that page by the += operator, > > Yes, it is. > > >> a=([1],) > >> a[0].append(2) # This is fine > > [In the following, I use the term "name" rather loosely

Re: Generating custom Windows installers

2012-04-05 Thread Mark Hammond
Seeing you are relying on win32com, you might as well add the links directly rather than via the intermediate WScript.shell object. Look in win32comext\shell\demos\create_link.py for an example of how to create shortcuts directly. HTH, Mark On 6/04/2012 5:23 AM, cesar.covarrub...@gmail.com

[ANN]: asyncoro: Framework for asynchronous sockets and coroutines

2012-04-05 Thread Giridhar Pemmasani
asyncoro is a framework for developing concurrent programs with asynchronous event completions and coroutines. Asynchronous completions currently implemented in asyncoro are socket I/O operations, sleep timers, (conditional) event notification and semaphores. Programs developed with asyncoro will h

escaping/encoding/formatting in python

2012-04-05 Thread Steve Howell
One of the biggest nuisances for programmers, just beneath date/time APIs in the pantheon of annoyances, is that we are constantly dealing with escaping/encoding/formatting issues. I wrote this little program as a cheat sheet for myself and others. Hope it helps. # escaping quotes legal_strin

Re: Python Gotcha's?

2012-04-05 Thread Dan Sommers
On 06 Apr 2012 01:03:45 GMT Steven D'Aprano wrote: > This is the 21st century, not 1960 ... Now there's a slippery slope, indeed. ;-) > ... and if the language designer is worried about the trivially small > extra effort of parsing ' as well as " then he's almost certainly > putting his effort

Re: Python Gotcha's?

2012-04-05 Thread Terry Reedy
On 4/5/2012 7:36 PM, Miki Tebeka wrote: Now, if you wish to boggle your mind about something pythonic, how about mutexes not being thread safe (http://bugs.python.org/issue1746071)? This is and old and deprecated module, you should not use it. Use http://docs.python.org/library/threading.html#t

Re: Python Gotcha's?

2012-04-05 Thread Dave Angel
On 04/05/2012 08:02 PM, Cameron Simpson wrote: > On 05Apr2012 19:13, Alain Ketterlin wrote: > | Miki Tebeka writes: > | > (Note that I want over http://wiki.python.org/moin/PythonWarts already). > | > | The "local variable and scoping" is, imho, something to be really > | careful about. Here is

Re: Python Gotcha's?

2012-04-05 Thread Steve Howell
On Apr 5, 6:03 pm, Steven D'Aprano wrote: > On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote: > > * Steven D'Aprano wrote: > > >> For a 21st century programming language or data format to accept only > >> one type of quotation mark as string delimiter is rather like having a > >> 21st century

String delimiter policy (was Re: Python Gotcha's?)

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 11:03 AM, Steven D'Aprano wrote: > KISS is a reason *for* allowing multiple string delimiters, not against > it. The simplicity which matters here are: > > * the user doesn't need to memorise which delimiter is allowed, and >  which is forbidden, which will be different from

Re: Python Gotcha's?

2012-04-05 Thread Steven D'Aprano
On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote: > * Steven D'Aprano wrote: > >> For a 21st century programming language or data format to accept only >> one type of quotation mark as string delimiter is rather like having a >> 21st century automobile with a hand crank to start the engine in

Re: Python Gotcha's?

2012-04-05 Thread Cameron Simpson
On 05Apr2012 23:08, André Malo wrote: | * Steven D'Aprano wrote: | | > For a 21st century programming language or data format to accept only one | > type of quotation mark as string delimiter is rather like having a 21st | > century automobile with a hand crank to start the engine instead of an |

Re: Python Gotcha's?

2012-04-05 Thread Cameron Simpson
On 05Apr2012 19:13, Alain Ketterlin wrote: | Miki Tebeka writes: | > (Note that I want over http://wiki.python.org/moin/PythonWarts already). | | The "local variable and scoping" is, imho, something to be really | careful about. Here is an example: | | class A(object): | def __init__(self):

Re: Python Gotcha's?

2012-04-05 Thread Miki Tebeka
> Now, if you wish to boggle your mind about something pythonic, how about > mutexes not being thread safe (http://bugs.python.org/issue1746071)? This is and old and deprecated module, you should not use it. Use http://docs.python.org/library/threading.html#threading.Lock and friends instead. I

Re: Python Gotcha's?

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 4:10 AM, Jon Clements wrote: > One I've had to debug... > text = 'abcdef' > if text.find('abc'): >        print 'found it!' > # Nothing prints as bool(0) is False > if text.find('bob'): >        print 'found it!' > found it! > > Someone new who hasn't read the

Re: produce the same output as Unix's date command

2012-04-05 Thread Mark Lawrence
Original Message Subject: Re: produce the same output as Unix's date command Date: Thu, 05 Apr 2012 22:07:42 +0100 From: Mark Lawrence Newsgroups: gmane.comp.python.general References: On 05/04/2012 21:52, Jabba Laci wrote: Hi, Unix's date command produces this output (e

Re: Python Gotcha's?

2012-04-05 Thread Evan Driscoll
On 4/5/2012 17:11, Evan Driscoll wrote: > In particular, the translation of 'a+=b' to 'temp = a + b; a = temp' is > *not* a very natural one to me. To expand on this point slightly, because of common C++ idioms guided by efficiency, I would be much more likely to think of 'a + b' as 'temp = a, tem

Re: Re: Re: Python Gotcha's?

2012-04-05 Thread Evan Driscoll
On 4/5/2012 13:44, Michael Hrivnak wrote: > This is not a gotcha, and it's not surprising. As John described, > you're assigning a new value to an index of a tuple, which tuples > don't support. Um, at least for me personally, yes, it is surprising, and yes, it is a gotcha. This goes back to wh

Re: produce the same output as Unix's date command

2012-04-05 Thread Chris Rebert
On Thu, Apr 5, 2012 at 1:52 PM, Jabba Laci wrote: > Hi, > > Unix's date command produces this output (example): > > Thu Apr  5 22:49:42 CEST 2012 > > I would like to produce the same output with Python, without calling > "date" externally. Before doing it I'd like to ask the list if anyone > has a

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article <4f7de152$0$29983$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I'm not the only one who has had trouble with JSON's poor design choice: This is getting a bit off-topic. If you wish to argue that JSON is designed poorly, you should do that in some appropriate JSON f

Re: Python Gotcha's?

2012-04-05 Thread André Malo
* Steven D'Aprano wrote: > For a 21st century programming language or data format to accept only one > type of quotation mark as string delimiter is rather like having a 21st > century automobile with a hand crank to start the engine instead of an > ignition. Even if there's a good reason for it (

produce the same output as Unix's date command

2012-04-05 Thread Jabba Laci
Hi, Unix's date command produces this output (example): Thu Apr 5 22:49:42 CEST 2012 I would like to produce the same output with Python, without calling "date" externally. Before doing it I'd like to ask the list if anyone has an existing solution for this. Thanks, Laszlo -- http://mail.pyt

Re: Python Gotcha's?

2012-04-05 Thread Grzegorz Staniak
On 05.04.2012, Roy Smith wroted: >> > There's absolutely no reason why JSON should follow Python syntax >> > rules. Making it support either kind of quotes would have >> > complicated every JSON library in the world, for no added value. >> >> I think these days it's not just "Python syntax", it

Re: Python Gotcha's?

2012-04-05 Thread Ian Kelly
On Thu, Apr 5, 2012 at 2:06 PM, Emile van Sebille wrote: > On 4/5/2012 11:10 AM Jon Clements said... > >> On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka  wrote: >>> >>> Greetings, >>> >>> I'm going to give a "Python Gotcha's" talk at work. >>> If you have an interesting/common "Gotcha" (wa

Re: Python Gotcha's?

2012-04-05 Thread Arnaud Delobelle
On 5 April 2012 21:06, Emile van Sebille wrote: > Kind of begs for a contains method that returns the appropriate boolean: > > if text.contains('bob') It's already there: text.__contains__('bob') It's usually spelt otherwise though: 'bob' in text -- Arnaud -- http://mail.python.org/

Re: Python Gotcha's?

2012-04-05 Thread Emile van Sebille
On 4/5/2012 11:10 AM Jon Clements said... On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: Greetings, I'm going to give a "Python Gotcha's" talk at work. If you have an interesting/common "Gotcha" (warts/dark corners ...) please share. (Note that I want over http://wiki.python.o

Generating custom Windows installers

2012-04-05 Thread cesar . covarrubias
Hello, I am working on creating an installer of a Python 3.2 application that we programmed. The end goal is to create an installer in which we can specify the install path, and create shortcuts in the Start Menu and Desktop. Ideally, we would like to give the users the option to create the Des

Re: Python Gotcha's?

2012-04-05 Thread Ian Kelly
On Thu, Apr 5, 2012 at 12:52 PM, Michael Hrivnak wrote: > I'm surprised nobody beat me to posting this: The OP beat you to it -- it's in the list at the wiki link. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-05 Thread Jon Clements
On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: > Greetings, > > I'm going to give a "Python Gotcha's" talk at work. > If you have an interesting/common "Gotcha" (warts/dark corners ...) please > share. > > (Note that I want over http://wiki.python.org/moin/PythonWarts already). >

Re: Re: Python Gotcha's?

2012-04-05 Thread Evan Driscoll
On 4/5/2012 13:24, Chris Angelico wrote: > I think this example highlights a major point about gotchas: the > difference between an obvious language feature and a gotcha depends on > where you come from. To a PHP programmer, 1 and "1" are in many ways > indistinguishable. To a C programmer, they're

Re: regexp partial matching, or hitEnd

2012-04-05 Thread Terry Reedy
On 4/5/2012 8:19 AM, Mark Lawrence wrote: More likely to go into the new regex module that's on pypi. Talking of which is this going into Python 3.3, I see it's mentioned in PEP398 but can't find any mention in the Python 3.3 What's New docs, or have I simply missed something? I think it has b

Re: Best way to disconnect from ldap?

2012-04-05 Thread Michael Ströder
John Gordon wrote: > class ldap.LDAPObject > Instances of LDAPObject are returned by initialize() and open() > (deprecated). The connection is automatically unbound and closed > when the LDAP object is deleted. > > So, given that, do I need to do anything at all? Hmm,

Re: Python Gotcha's?

2012-04-05 Thread Michael Hrivnak
I'm surprised nobody beat me to posting this: >>> def foo(stuff=[]): ... stuff.append('bar') ... print stuff ... >>> foo() ['bar'] >>> foo() ['bar', 'bar'] >>> foo() ['bar', 'bar', 'bar'] On Wed, Apr 4, 2012 at 6:34 PM, Miki Tebeka wrote: > Greetings, > > I'm going to give a "Python Gotcha's"

Re: Re: Python Gotcha's?

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 4:44 AM, Michael Hrivnak wrote: > This is not a gotcha, and it's not surprising.  As John described, > you're assigning a new value to an index of a tuple, which tuples > don't support. > > a[0] += [3] > > is the same as > > a[0] = a[0] + [3] > > which after evaluation is th

Re: Re: Python Gotcha's?

2012-04-05 Thread Michael Hrivnak
This is not a gotcha, and it's not surprising. As John described, you're assigning a new value to an index of a tuple, which tuples don't support. a[0] += [3] is the same as a[0] = a[0] + [3] which after evaluation is the same as a[0] = [1, 3] You can always modify an item that happens to be

Re: Best way to disconnect from ldap?

2012-04-05 Thread John Gordon
In John Gordon writes: > I'm writing an application that interacts with ldap, and I'm looking > for advice on how to handle the connection. Specifically, how to > close the ldap connection when the application is done. > I wrote a class to wrap an LDAP connection, similar to this: > impor

Re: Python Gotcha's?

2012-04-05 Thread Steven D'Aprano
On Thu, 05 Apr 2012 11:06:11 +, Duncan Booth wrote: > Steven D'Aprano wrote: > >> JSON expects double-quote marks, not single: >> v = json.loads("{'test':'test'}") fails v = >> json.loads('{"test":"test"}') succeeds >> >> > You mean JSON expects a string with valid JSON? Quelle s

Re: Python Gotcha's?

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 4:08 AM, Roy Smith wrote: >> If you are working with data that is representable as either an integer >> or a string, choose one and stick to it.  Treating it as both/either will >> eventually lead to grief. >> >> Or, in other words: 1 != '1' > > Tell that to the PHP crowd :-

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-04-05 Thread Nathan Rice
Re-trolling. On Wed, Apr 4, 2012 at 1:49 AM, Steven D'Aprano wrote: >> As part of my troll-outreach effort, I will indulge here.  I was >> specifically thinking about some earlier claims that programming >> languages as they currently exist are somehow inherently superior to a >> formalized natur

Re: Python Gotcha's?

2012-04-05 Thread Steven D'Aprano
On Thu, 05 Apr 2012 08:32:10 -0400, Roy Smith wrote: > In article <4f7d896f$0$29983$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> > You mean JSON expects a string with valid JSON? Quelle surprise. >> >> No. The surprise is that there exists a tool invented in the 21st >> c

Re: inheritance

2012-04-05 Thread Ian Kelly
On Thu, Apr 5, 2012 at 11:50 AM, Yagnesh Raghava Yakkala wrote: >>>you will have >>> to pass the instance in explicitly as the self argument.  For example: >> >>> B.foo(x)  # calls B.foo directly with instance x > > After follow up, I see one problem(can i say that?) with this. With python > overw

[solved] Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello, With Chris and Ian help (Thank you both) I end up writing the example script like this,(just for the record) - #! /usr/bin/env python3 # -*- coding: utf-8 -*- class A(object): def __init__(self, a): print('a = ', a) self.a = a

Re: inheritance

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 4:09 AM, Yagnesh Raghava Yakkala wrote: > Thanks for explaining. It makes sense. I see that python interpreter can > instantly tell the list of defined methods in the super class(es). So "keeping > track" thing is not at all a problem. > > Thanks a lot again. Most welcome!

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article , John Gordon wrote: > In <7367295.815.1333578860181.JavaMail.geo-discussion-forums@ynpp8> Miki > Tebeka writes: > > > Greetings, > > > I'm going to give a "Python Gotcha's" talk at work. > > If you have an interesting/common "Gotcha" (warts/dark corners ...) > > please share. >

Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello Chris, Chris Angelico writes: > > If you're subclassing something, you should generally work with the > intention that an instance of your class will function viably in any > situation in which an instance of the parent is wanted. So if you're > writing a method of the same name as one in

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article , Grzegorz Staniak wrote: > On 05.04.2012, Roy Smith wroted: > > > There's absolutely no reason why JSON should follow Python syntax > > rules. Making it support either kind of quotes would have > > complicated every JSON library in the world, for no added value. > > I think these

Re: Difference between tempfile and spooled tempfile?

2012-04-05 Thread Steve Howell
On Apr 5, 8:10 am, Steve Howell wrote: > On Apr 5, 7:50 am, "Alex van der Spek" wrote: > > > > > > > > > > > I do not understand why the spooled write gives an error. See below. > > The normal tempfile works just fine. They are supposed to behave equal? > > > All insight you can provide is welcom

Re: inheritance

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 3:50 AM, Yagnesh Raghava Yakkala wrote: > After follow up, I see one problem(can i say that?) with this. With python > overwriting methods of super class(es), one need to keep track of all the > methods ever defined in the super class(es). do everybody do a check before > wr

Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello Ian, Yagnesh Raghava Yakkala writes: > Hello Ian, > > Ian Kelly writes: [snipped 21 lines] > >>you will have >> to pass the instance in explicitly as the self argument. For example: > >> B.foo(x) # calls B.foo directly with instance x After follow up, I see one problem(can i say tha

Re: inheritance

2012-04-05 Thread Yagnesh Raghava Yakkala
Hello Ian, Ian Kelly writes: > On Thu, Apr 5, 2012 at 10:50 AM, yag wrote: >> three classes A,B,C and instance x. >> >> now how can I call methods foo in class A and B using 'x' instance. (I hope I >> could pronounce the terminology correct) > > Do you mean that you want C.foo to call B.foo, a

Re: inheritance

2012-04-05 Thread yagnesh
Chris Angelico writes: > On Fri, Apr 6, 2012 at 2:50 AM, yag wrote: >> [snipped 19 lines] > In each case, you are overriding the foo() method, so your instance > will only execute the last one. If you want to chain to the others, > you need to write your methods to do so - which is what you've

Re: Python Gotcha's?

2012-04-05 Thread Alain Ketterlin
Miki Tebeka writes: [...] > (Note that I want over http://wiki.python.org/moin/PythonWarts already). The "local variable and scoping" is, imho, something to be really careful about. Here is an example: class A(object): def __init__(self): self.x = 0 def r(self): return x

Re: inheritance

2012-04-05 Thread Ian Kelly
On Thu, Apr 5, 2012 at 10:50 AM, yag wrote: > three classes A,B,C and instance x. > > now how can I call methods foo in class A and B using 'x' instance. (I hope I > could pronounce the terminology correct) Do you mean that you want C.foo to call B.foo, and B.foo to call A.foo? If that is the ca

Re: inheritance

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 2:50 AM, yag wrote: > > Hello, > > I am new to python (or to any programming language). My first post on this > list, > so please go easy. Apologies if its a FAQ. Welcome! > class A(object): >    def foo(self): >        print('printing from foo in A = ',self.a) > > class

inheritance

2012-04-05 Thread yag
Hello, I am new to python (or to any programming language). My first post on this list, so please go easy. Apologies if its a FAQ. Here is what I have #! /usr/bin/env python3 # -*- coding: utf-8 -*- class A(object): def __init__(self, a): print('a =

Re: Python Gotcha's?

2012-04-05 Thread Chris Angelico
On Fri, Apr 6, 2012 at 2:25 AM, Grzegorz Staniak wrote: > On 05.04.2012, Roy Smith wroted: > >> There's absolutely no reason why JSON should follow Python syntax >> rules. Making it support either kind of quotes would have >> complicated every JSON library in the world, for no added value. > > I

Re: Python Gotcha's?

2012-04-05 Thread Tycho Andersen
On Thu, Apr 05, 2012 at 08:32:10AM -0400, Roy Smith wrote: > > One of the hardest things about writing parsers is generating helpful > error messages when things don't parse. But, it's only of value to do > that when you're parsing something you expect to be written by a human, > and thus a hum

Re: Python Gotcha's?

2012-04-05 Thread Grzegorz Staniak
On 05.04.2012, Roy Smith wroted: > There's absolutely no reason why JSON should follow Python syntax > rules. Making it support either kind of quotes would have > complicated every JSON library in the world, for no added value. I think these days it's not just "Python syntax", it's kinda somethi

Re: Python Gotcha's?

2012-04-05 Thread John Gordon
In <7367295.815.1333578860181.JavaMail.geo-discussion-forums@ynpp8> Miki Tebeka writes: > Greetings, > I'm going to give a "Python Gotcha's" talk at work. > If you have an interesting/common "Gotcha" (warts/dark corners ...) > please share. This is fairly pedestrian as gotchas go, but it has b

Re: python polygon

2012-04-05 Thread Mark Lawrence
On 05/04/2012 14:49, Kevin Zhang wrote: Hi, I found python polygon link in this page http://pypi.python.org/pypi/Polygon/1.17 was invalid now. http://polygon.origo.ethz.ch/download 404 - Project not found Ooops, the subdomain is not valid because the according project does not (yet) exist. Go

Re: Google Tech Talk: lisp at JPL

2012-04-05 Thread RG
In article <6a4a234d-db48-4659-8714-098d79fb9...@l30g2000yqb.googlegroups.com>, ccc31807 wrote: > On Apr 3, 1:53ハam, Xah Lee wrote: > > 〈The Remote Agent Experiment: Debugging Code from 60 Million Miles > > Away〉 > > Google Tech Talk, (2012-02-14) Presented by Ron Garret. > > @http://www.yout

Re: Python Gotcha's?

2012-04-05 Thread Steve Howell
On Apr 5, 8:23 am, Iain King wrote: > A common one used to be expecting .sort() to return, rather than mutate (as > it does).  Same with .reverse() - sorted and reversed have this covered, not > sure how common a gotcha it is any more. > The sort()/sorted() variations are good to cover. To giv

Re: Python Gotcha's?

2012-04-05 Thread Iain King
A common one used to be expecting .sort() to return, rather than mutate (as it does). Same with .reverse() - sorted and reversed have this covered, not sure how common a gotcha it is any more. Iain On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: > Greetings, > > I'm going to

Re: Difference between tempfile and spooled tempfile?

2012-04-05 Thread Steve Howell
On Apr 5, 7:50 am, "Alex van der Spek" wrote: > I do not understand why the spooled write gives an error. See below. > The normal tempfile works just fine. They are supposed to behave equal? > > All insight you can provide is welcome. > Alex van der Spek > > +++

Difference between tempfile and spooled tempfile?

2012-04-05 Thread Alex van der Spek
I do not understand why the spooled write gives an error. See below. The normal tempfile works just fine. They are supposed to behave equal? All insight you can provide is welcome. Alex van der Spek + Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:

Re: Python Gotcha's?

2012-04-05 Thread Robert Kern
On 4/5/12 3:15 PM, John Posner wrote: On 4/4/2012 7:32 PM, Chris Angelico wrote: Don't know if it's what's meant on that page by the += operator, Yes, it is. a=([1],) a[0].append(2) # This is fine [In the following, I use the term "name" rather loosely.] The append() method attempts to mo

Re: Python Gotcha's?

2012-04-05 Thread Steve Howell
On Apr 5, 5:00 am, Steven D'Aprano wrote: > On Thu, 05 Apr 2012 11:06:11 +, Duncan Booth wrote: > > Steven D'Aprano wrote: > > >> JSON expects double-quote marks, not single: > >>     v = json.loads("{'test':'test'}")  fails v = > >>     json.loads('{"test":"test"}')  succeeds > > > You mean

Re: Python Gotcha's?

2012-04-05 Thread Steve Howell
On Apr 5, 5:32 am, Roy Smith wrote: > [...] Nobody expects > that a JSON parser will be parsing human-written input, [...] Humans write JSON all the time. People use JSON as a configuration language, and some people actually write JSON files by hand. A common example would be writing package.js

Re: Re: Python Gotcha's?

2012-04-05 Thread John Posner
On 4/4/2012 7:32 PM, Chris Angelico wrote: > Don't know if it's what's meant on that page by the += operator, Yes, it is. >> a=([1],) >> a[0].append(2) # This is fine [In the following, I use the term "name" rather loosely.] The append() method attempts to modify the object whose name is "a[0]"

python polygon

2012-04-05 Thread Kevin Zhang
Hi, I found python polygon link in this page http://pypi.python.org/pypi/Polygon/1.17 was invalid now. http://polygon.origo.ethz.ch/download 404 - Project not found Ooops, the subdomain is not valid because the according project does not (yet) exist. Go to the Origo main page at http://origo.eth

Re: Cannot connect to IMAP server in Python 3.2

2012-04-05 Thread Steve Howell
On Apr 5, 5:25 am, Steven D'Aprano wrote: > On Thu, 05 Apr 2012 12:16:09 +, Steven D'Aprano wrote: > > On Thu, 05 Apr 2012 00:21:31 -0700, Steve Howell wrote: > >> Why are you changing the invocation between versions of Python? > > > Because imaplib.IMAP4_SSL apparently no longer exists in Pyt

Re: Python Gotcha's?

2012-04-05 Thread Tim Wintle
On Thu, 2012-04-05 at 12:00 +, Steven D'Aprano wrote: > The reason this is a Gotcha rather than a bug is because the JSON > standard specifies the behaviour (probably in order to be compatible with > Javascript). It's not to be compatible with javascript (you can use either in javascript) I

Re: Cannot connect to IMAP server in Python 3.2

2012-04-05 Thread Damien Wyart
* Steven D'Aprano in comp.lang.python: > IMAP4_SSL is documented as existing in Python 3. And when I run Python > 3.2 on a Centos machine, instead of Debian, it includes IMAP4_SSL which > works fine. > So there's something screwy going on here. Why does my Python 3.2 on > Debian not include IMA

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article <4f7d896f$0$29983$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > You mean JSON expects a string with valid JSON? Quelle surprise. > > No. The surprise is that there exists a tool invented in the 21st century > that makes a distinction between strings quoted with " a

Re: Cannot connect to IMAP server in Python 3.2

2012-04-05 Thread Steven D'Aprano
On Thu, 05 Apr 2012 12:16:09 +, Steven D'Aprano wrote: > On Thu, 05 Apr 2012 00:21:31 -0700, Steve Howell wrote: >> Why are you changing the invocation between versions of Python? > > Because imaplib.IMAP4_SSL apparently no longer exists in Python 3. > server = imaplib.IMAP4_SSL('x

Re: Cannot connect to IMAP server in Python 3.2

2012-04-05 Thread Steven D'Aprano
On Thu, 05 Apr 2012 00:21:31 -0700, Steve Howell wrote: > I'm not suggesting that you debug the standard library because I think > the library itself is broken. I'm suggesting that using the source code > that's freely available to you can help you have some insight on what's > going wrong. > > D

Re: regexp partial matching, or hitEnd

2012-04-05 Thread Mark Lawrence
On 05/04/2012 08:29, Константин Куликов wrote: I want something like this in python : http://stackoverflow.com/questions/2526756/can-java-util-regex-pattern-do-partia... First you have to call one of the

Re: Python Gotcha's?

2012-04-05 Thread Steven D'Aprano
On Thu, 05 Apr 2012 11:06:11 +, Duncan Booth wrote: > Steven D'Aprano wrote: > >> JSON expects double-quote marks, not single: >> v = json.loads("{'test':'test'}") fails v = >> json.loads('{"test":"test"}') succeeds >> >> > You mean JSON expects a string with valid JSON? Quelle s

Re: Python Gotcha's?

2012-04-05 Thread Chris Angelico
On Thu, Apr 5, 2012 at 9:06 PM, Duncan Booth wrote: > Steven D'Aprano wrote: > >> JSON expects double-quote marks, not single: >>     v = json.loads("{'test':'test'}")  fails >>     v = json.loads('{"test":"test"}')  succeeds >> > > You mean JSON expects a string with valid JSON? > Quelle surpris

Re: Python Gotcha's?

2012-04-05 Thread Duncan Booth
Steven D'Aprano wrote: > JSON expects double-quote marks, not single: > v = json.loads("{'test':'test'}") fails > v = json.loads('{"test":"test"}') succeeds > You mean JSON expects a string with valid JSON? Quelle surprise. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail

Re: Cannot connect to IMAP server in Python 3.2

2012-04-05 Thread Steve Howell
On Apr 5, 12:09 am, Steven D'Aprano wrote: > On Wed, 04 Apr 2012 22:13:55 -0700, Steve Howell wrote: > > On Apr 4, 9:49 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> I can connect to an IMAP server using Python 2.6: > > >> steve@runes:~$ python2.6 > >> Python 2.6.6 (r266:8429

regexp partial matching, or hitEnd

2012-04-05 Thread Константин Куликов
I want something like this in python : http://stackoverflow.com/questions/2526756/can-java-util-regex-pattern-do-partia... First you have to call one of the standard methods to apply the regex, like matches

Re: Cannot connect to IMAP server in Python 3.2

2012-04-05 Thread Steve Howell
On Apr 5, 12:09 am, Steven D'Aprano wrote: > On Wed, 04 Apr 2012 22:13:55 -0700, Steve Howell wrote: > > On Apr 4, 9:49 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> I can connect to an IMAP server using Python 2.6: > > >> steve@runes:~$ python2.6 > >> Python 2.6.6 (r266:8429

Re: Cannot connect to IMAP server in Python 3.2

2012-04-05 Thread Steven D'Aprano
On Wed, 04 Apr 2012 22:13:55 -0700, Steve Howell wrote: > On Apr 4, 9:49 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> I can connect to an IMAP server using Python 2.6: >> >> steve@runes:~$ python2.6 >> Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) [GCC 4.4.5] on linux2 >> Typ

Re: xlrd 0.7.6 released!

2012-04-05 Thread Chris Withers
On 04/04/2012 20:26, Karim wrote: By the way, I reported an issue to you in this mailing list some time ago about unicode data. I have no recollection of this. If you experience any bugs, the correct place to report them is: https://github.com/python-excel/xlrd/issues cheers, Chris -- Simp