Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Terry Jan Reedy
On 6/10/2013 10:56 PM, Steven D'Aprano wrote: I was initially confused and reading the code still takes a small bit of extra mental energy. Idle stays confused and will wrongly color the list instance name until it is changed. Calling the file list 'fnames' or 'filenames' would have been

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Peter Otten
Fábio Santos wrote: On 10 Jun 2013 23:54, Roel Schroeven r...@roelschroeven.net wrote: You could do something like: new_songs, old_songs = [], [] [(new_songs if s.is_new() else old_songs).append(s) for s in songs] But I'm not sure that that's any better than the long version. This is

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Jonas Geiregat
On 11 Jun 2013, at 01:08, Fábio Santos wrote: On 10 Jun 2013 23:54, Roel Schroeven r...@roelschroeven.net wrote: You could do something like: new_songs, old_songs = [], [] [(new_songs if s.is_new() else old_songs).append(s) for s in songs] But I'm not sure that that's any better

Re: Simple program question.

2013-06-11 Thread eschneider92
No. -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Peter Otten
Terry Jan Reedy wrote: Many long-time posters have advised Don't rebind built-in names*. I'm in that camp, but I think this old post by Guido van Rossum is worth reading to put the matter into perspective: That was probably a checkin I made. I would have left it alone except the code was

Re: Popen and reading stdout in windows

2013-06-11 Thread Pete Forman
Joseph L. Casale jcas...@activenetwerx.com writes: You leave out an awful amount of detail. I have no idea what ST is, so I'll have to guess your real problem. Ugh, sorry guys its been one of those days, the post was rather useless... I am using Popen to run the exe with communicate() and

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-11 Thread russ . pobox
Just try this in the interpreter and see. for key, value in sorted(months.items(), key=lambda x:x[1]): print %s %s % (value, key) -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing filenames from Greeklish = Greek (subprocess complain)

2013-06-11 Thread Larry Hudson
On 06/10/2013 01:11 AM, Νικόλαος Κούρας wrote: Τη Δευτέρα, 10 Ιουνίου 2013 10:51:34 π.μ. UTC+3, ο χρήστης Larry Hudson έγραψε: I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. 0 - 127, yes. 128 - 255 - one byte of a multibyte code. you

Re: Popen and reading stdout in windows

2013-06-11 Thread Chris Rebert
On Jun 11, 2013 12:21 AM, Pete Forman petef4+use...@gmail.com wrote: Joseph L. Casale jcas...@activenetwerx.com writes: You leave out an awful amount of detail. I have no idea what ST is, so I'll have to guess your real problem. Ugh, sorry guys its been one of those days, the post was

Re: Simple program question.

2013-06-11 Thread russ . pobox
input() is a function which returns a string. You can assign this return value to a variable. That's what variables are for. option = input() Now you can use the variable named option in place of all those calls to input(). i.e: ...instead of.. if input() == 'parry': # etc ...do

Re: Encoding questions (continuation)

2013-06-11 Thread Larry Hudson
On 06/10/2013 06:56 AM, Νικόλαος Κούρας wrote: ps. i tried to post a reply to the thread i opend via thunderbird mail client, but not as a reply to somne other reply but as new mail send to python list. because of that a new thread will be opened. How can i tell thunderbird to reply to the

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-11 Thread Larry Hudson
On 06/10/2013 01:29 AM, Νικόλαος Κούρας wrote: Trying this: months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 'Μάϊος':5, 'Ιούνιος':6, \ 'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 'Νοέμβριος':11, 'Δεκέμβριος':12 } for key in sorted(

RE: Popen and reading stdout in windows

2013-06-11 Thread Nobody
On Tue, 11 Jun 2013 01:50:07 +, Joseph L. Casale wrote: I am using Popen to run the exe with communicate() and I have sent stdout to PIPE without luck. Just not sure what is the proper way to iterate over the stdout as it eventually makes its way from the buffer. The proper way is:

Receing a form variable as a list instead of as a string

2013-06-11 Thread Νικόλαος Κούρας
page = form.getvalue('page') if form.getvalue('show') == 'log' or page: # it is a python script page = page.replace( '/home/nikos/public_html/cgi-bin/', '' ) elif os.path.exists( page ): # it is an html template page = page.replace( '/home/nikos/public_html/', '' )

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread rusi
On Jun 11, 12:09 pm, Peter Otten __pete...@web.de wrote: Terry Jan Reedy wrote: Many long-time posters have advised Don't rebind built-in names*. I'm in that camp, but I think this old post by Guido van Rossum is worth reading to put the matter into perspective: Not sure what you are saying

OT: e-mail reply to old/archived message (was Re: Encoding questions (continuation))

2013-06-11 Thread Andreas Perstinger
On 10.06.2013 15:56, Νικόλαος Κούρας wrote: Τη Δευτέρα, 10 Ιουνίου 2013 2:41:07 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: On Mon, 10 Jun 2013 14:13:00 +0300, Νικόλαος Κούρας wrote: ps. i tried to post a reply to the thread i opend via thunderbird mail client, but not as a reply to somne

Re: Build Python 2.7.5 - Modules missing

2013-06-11 Thread rusi
On Jun 10, 10:51 pm, Walter Hurry walterhu...@lavabit.com wrote: On building Python 2.7.5 I got the following message: Python build finished, but the necessary bits to build these modules  were not found: dl                 imageop            linuxaudiodev spwd               sunaudiodev To

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Andreas Perstinger
On 11.06.2013 12:38, Νικόλαος Κούρας wrote: but page is a form variable coming from a previous sumbitted form why the error says 'page' is a list? RTFM: If the submitted form data contains more than one field with the same name, the object retrieved by form[key] is not a FieldStorage or

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Peter Otten
rusi wrote: On Jun 11, 12:09 pm, Peter Otten __pete...@web.de wrote: Terry Jan Reedy wrote: Many long-time posters have advised Don't rebind built-in names*. I'm in that camp, but I think this old post by Guido van Rossum is worth reading to put the matter into perspective: Not sure

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Ulrich Eckhardt
Am 11.06.2013 12:38, schrieb Νικόλαος Κούρας: File /home/nikos/public_html/cgi-bin/metrites.py, line 28, in module, referer: http://xxxredactedxxx/ page = page.replace( '/home/nikos/public_html/', '' ), referer: http://xxxredactedxxx/ AttributeError: 'list' object has no attribute

[ANN] ErlPort (library to connect Erlang to Python) 1.0.0alpha released

2013-06-11 Thread Dmitry Vasilev
Hi all, I've just released ErlPort version 1.0.0alpha. ErlPort is a library for Erlang which helps connect Erlang to a number of other programming languages (currently supported Python and Ruby). Apart from using ErlPort as a tool to call Python/Ruby functions from Erlang it also can be used

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Steven D'Aprano
On Tue, 11 Jun 2013 04:12:38 -0700, rusi wrote: [...] then what the message of the Guido-quote is, is not clear (at least to me). The relevant part is in the bit that you deleted. Let me quote it for you again: locals hiding built-ins is okay -- Guido van Rossum, inventor and BDFL of

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Fábio Santos
On 11 Jun 2013 07:47, Peter Otten __pete...@web.de wrote: Fábio Santos wrote: On 10 Jun 2013 23:54, Roel Schroeven r...@roelschroeven.net wrote: You could do something like: new_songs, old_songs = [], [] [(new_songs if s.is_new() else old_songs).append(s) for s in songs] But I'm

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Joshua Landau
On 11 June 2013 01:11, Peter Otten __pete...@web.de wrote: def partition(items, predicate=bool): a, b = itertools.tee((predicate(item), item) for item in items) return ((item for pred, item in a if not pred), (item for pred, item in b if pred)) I have to tell you this is

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Joshua Landau
On 11 June 2013 01:14, Terry Jan Reedy tjre...@udel.edu wrote: Many long-time posters have advised Don't rebind built-in names*. For instance, open Lib/idlelib/GrepDialog.py in an editor that colorizes Python syntax, such as Idle's editor, jump down to the bottom and read up, and (until it is

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Rick Johnson
On Monday, June 10, 2013 9:56:43 PM UTC-5, Steven D'Aprano wrote: On Mon, 10 Jun 2013 20:14:55 -0400, Terry Jan Reedy wrote: For instance, open Lib/idlelib/GrepDialog.py in an editor that colorizes Python syntax, such as Idle's editor, jump down to the bottom and read up, and (until it is

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Serhiy Storchaka
11.06.13 07:11, Roy Smith написав(ла): In article mailman.2992.1370904643.3114.python-l...@python.org, Roel Schroeven r...@roelschroeven.net wrote: new_songs, old_songs = [], [] [(new_songs if s.is_new() else old_songs).append(s) for s in songs] Thanks kind of neat, thanks. I'm trying to

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Serhiy Storchaka
11.06.13 01:50, Chris Angelico написав(ла): On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith r...@panix.com wrote: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not s.is_new()] Hmm. Would this serve? old_songs = songs[:] new_songs = [songs.remove(s) or s for s in

Re: py_compile vs. built-in compile, with __future__

2013-06-11 Thread Neil Cerutti
On 2013-06-10, dhyams dhy...@gmail.com wrote: On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote: Can you read the file into a string, prepend a future directive, and then compile the string? Technically yes, except that now there is complication of writing the modified module

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Rick Johnson
On Tuesday, June 11, 2013 8:34:55 AM UTC-5, Steven D'Aprano wrote: GvR is saying that it's okay to use the names of built-in functions or types as the names of local variables, even if that causes the built-in to be inaccessible within that function. Looks like we've finally found the

PyGame tutorial?

2013-06-11 Thread Eam onn
Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he didn't finish his. MetalX100 did a VERY good tutorial. I've been having trouble with some player movement because he isn't moving smoothly, he jumps. If I add 5 pixels to his X position if I press a button, jumps to the

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Serhiy Storchaka
11.06.13 06:02, Steven D'Aprano написав(ла): On Mon, 10 Jun 2013 19:36:44 -0700, rusi wrote: And so languages nowadays tend to 'protect' against this feature. Apart from Erlang, got any other examples? C#? At least local variable can't shadow other local variable in outer scope (and it

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 9:47 AM, Eam onn letsplaysf...@gmail.com wrote: Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he didn't finish his. MetalX100 did a VERY good tutorial. I've been having trouble with some player movement because he isn't moving smoothly, he

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Grant Edwards
On 2013-06-11, Mark Janssen dreamingforw...@gmail.com wrote: list = [] Reading further, one sees that the function works with two lists, a list of file names, unfortunately called 'list', That is very good advice in general: never choose a variable name that is a keyword. Btw,

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Mark Lawrence
On 11/06/2013 16:43, Rick Johnson wrote: On Tuesday, June 11, 2013 8:34:55 AM UTC-5, Steven D'Aprano wrote: GvR is saying that it's okay to use the names of built-in functions or types as the names of local variables, even if that causes the built-in to be inaccessible within that function.

Re: PyGame tutorial?

2013-06-11 Thread Mark Lawrence
On 11/06/2013 16:47, Eam onn wrote: Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he didn't finish his. MetalX100 did a VERY good tutorial. I've been having trouble with some player movement because he isn't moving smoothly, he jumps. If I add 5 pixels to his X

PYTHONPATH: dev and prod

2013-06-11 Thread jacopo
I am developing my code in the path: /py/myscripts /py/mylib In order to import mylib, I need to add /py/mylib to PYTHONPATH. Now I want to save a snapshot of the current code in the production directory, I will copy all in: /prod/myscripts /prod/mylib The problem now is that when I execute

Re: Split a list into two parts based on a filter?

2013-06-11 Thread rusi
On Jun 11, 6:48 pm, Fábio Santos fabiosantos...@gmail.com wrote: What I like so much about it is the .. if .. else .. Within the parenthesis and the append() call outside these parenthesis. You can do this -- which does not mix up functional and imperative styles badly and is as much a 2-liner

Re: PyGame tutorial?

2013-06-11 Thread Eam onn
On Tuesday, June 11, 2013 5:31:22 PM UTC+1, Mark Lawrence wrote: On 11/06/2013 16:47, Eam onn wrote: Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he didn't finish his. MetalX100 did a VERY good tutorial. I've been having trouble with some player movement

Re: PyGame tutorial?

2013-06-11 Thread Eam onn
On Tuesday, June 11, 2013 5:00:13 PM UTC+1, Ian wrote: On Tue, Jun 11, 2013 at 9:47 AM, Eam onn letsplaysf...@gmail.com wrote: Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he didn't finish his. MetalX100 did a VERY good tutorial. I've been having trouble with

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Steven D'Aprano
On Tue, 11 Jun 2013 08:22:19 -0700, Rick Johnson wrote: On Monday, June 10, 2013 9:56:43 PM UTC-5, Steven D'Aprano wrote: On Mon, 10 Jun 2013 20:14:55 -0400, Terry Jan Reedy wrote: Reading further, one sees that the function works with two lists, a list of file names, unfortunately called

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Fábio Santos
On 11 Jun 2013 17:47, rusi rustompm...@gmail.com wrote: [Of course I would prefer a 3-liner where the body of the for is indented :-) ] Is this an aside comprehension? -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:56 AM, Eam onn letsplaysf...@gmail.com wrote: Also, is there a specific forum for PyGame or is here fine? Go to pygame.org and click the link Help (irc, lists) in the navigation menu. I could give you the direct link, but I want to point out that this stuff is readily

Re: PyGame tutorial?

2013-06-11 Thread Alister
On Tue, 11 Jun 2013 09:57:17 -0700, Eam onn wrote: On Tuesday, June 11, 2013 5:31:22 PM UTC+1, Mark Lawrence wrote: On 11/06/2013 16:47, Eam onn wrote: Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he didn't finish his. MetalX100 did a VERY good tutorial. I've

Re: PYTHONPATH: dev and prod

2013-06-11 Thread rusi
On Jun 11, 9:28 pm, jacopo jacopo.pe...@gmail.com wrote: I am developing my code in the path: /py/myscripts /py/mylib In order to import mylib, I need to add /py/mylib to PYTHONPATH. Now I want to save a snapshot of the current code in the production directory, I will copy all in:

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:57 AM, Eam onn letsplaysf...@gmail.com wrote: On Tuesday, June 11, 2013 5:31:22 PM UTC+1, Mark Lawrence wrote: Try typing pygame tutorial into your favourite search and see what comes back, you might be pleasantly surprised. Typed it in several times over the past 2

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Chris Angelico
On Wed, Jun 12, 2013 at 1:28 AM, Serhiy Storchaka storch...@gmail.com wrote: 11.06.13 01:50, Chris Angelico написав(ла): On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith r...@panix.com wrote: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not s.is_new()] Hmm.

Re: Split a list into two parts based on a filter?

2013-06-11 Thread rusi
On Jun 11, 10:05 pm, Fábio Santos fabiosantos...@gmail.com wrote: On 11 Jun 2013 17:47, rusi rustompm...@gmail.com wrote: [Of course I would prefer a 3-liner where the body of the for is indented :-) ] Is this an aside comprehension? Eh? Its a for-loop. Same as: for s in songs:

Re: Don't rebind built-in names* - it confuses readers

2013-06-11 Thread Chris Angelico
On Wed, Jun 12, 2013 at 1:22 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: PS: Is that D in last name short for DevilsAdvocate? Steven DevilsAdvocate Prano. I don't think so. Somehow it seems unlikely that he'll argue for you. ChrisA --

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Chris Angelico
On Wed, Jun 12, 2013 at 3:23 AM, rusi rustompm...@gmail.com wrote: On Jun 11, 10:05 pm, Fábio Santos fabiosantos...@gmail.com wrote: On 11 Jun 2013 17:47, rusi rustompm...@gmail.com wrote: [Of course I would prefer a 3-liner where the body of the for is indented :-) ] Is this an aside

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Fábio Santos
On 11 Jun 2013 18:48, Chris Angelico ros...@gmail.com wrote: On Wed, Jun 12, 2013 at 3:23 AM, rusi rustompm...@gmail.com wrote: On Jun 11, 10:05 pm, Fábio Santos fabiosantos...@gmail.com wrote: On 11 Jun 2013 17:47, rusi rustompm...@gmail.com wrote: [Of course I would prefer a 3-liner

Re: Split a list into two parts based on a filter?

2013-06-11 Thread rusi
On Jun 11, 10:37 pm, Chris Angelico ros...@gmail.com wrote: On Wed, Jun 12, 2013 at 3:23 AM, rusi rustompm...@gmail.com wrote: On Jun 11, 10:05 pm, Fábio Santos fabiosantos...@gmail.com wrote: On 11 Jun 2013 17:47, rusi rustompm...@gmail.com wrote: [Of course I would prefer a 3-liner

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Peter Otten
Chris Angelico wrote: On Wed, Jun 12, 2013 at 1:28 AM, Serhiy Storchaka storch...@gmail.com wrote: 11.06.13 01:50, Chris Angelico написав(ла): On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith r...@panix.com wrote: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Peter Otten
Joshua Landau wrote: On 11 June 2013 01:11, Peter Otten __pete...@web.de wrote: def partition(items, predicate=bool): a, b = itertools.tee((predicate(item), item) for item in items) return ((item for pred, item in a if not pred), (item for pred, item in b if pred)) I

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Chris Angelico
On Wed, Jun 12, 2013 at 4:13 AM, Peter Otten __pete...@web.de wrote: Chris Angelico wrote: On Wed, Jun 12, 2013 at 1:28 AM, Serhiy Storchaka storch...@gmail.com wrote: 11.06.13 01:50, Chris Angelico написав(ла): On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith r...@panix.com wrote: new_songs =

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Νικόλαος Κούρας
Τη Τρίτη, 11 Ιουνίου 2013 2:51:04 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: For that, you'd have to adjust the code that you received it from. If that's not possible, convert it to a string yourself. But didn't you want a form variable? i manages to work around it by using this:

Re: Do you consider Python a 4GL? Why (not)?

2013-06-11 Thread Laurent Pointal
Dennis Lee Bieber wrote: On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg drsali...@gmail.com declaimed the following in gmane.comp.python.general: Perhaps Scripting language is the best general category we have that Python fits into. But I hope not. Heh... Having encountered ARexx

Re: Encoding questions (continuation)

2013-06-11 Thread Νικόλαος Κούρας
Τη Τρίτη, 11 Ιουνίου 2013 1:19:25 π.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε: Maybe he just want to prove we are smart enough... Or maybe his encoding algorithm needs some refinement :-) I already knwo you are smart enough, the latter is what needs some more refinement work :-) --

Re: Encoding questions (continuation)

2013-06-11 Thread Νικόλαος Κούρας
Τη Τρίτη, 11 Ιουνίου 2013 10:52:02 π.μ. UTC+3, ο χρήστης Larry Hudson έγραψε: On 06/10/2013 06:56 AM, Νικόλαος Κούρας wrote: ps. i tried to post a reply to the thread i opend via thunderbird mail client, but not as a reply to somne other reply but as new mail send to python list.

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread Νικόλαος Κούρας
But if i write it as: if not page and os.path.exists( file ): # it is an html template page = file.replace( '/home/nikos/public_html/', '' ) elif page or form.getvalue('show') == 'log': # it is a python script page = page elif page or form.getvalue('show') ==

Re: OT: e-mail reply to old/archived message (was Re: Encoding questions (continuation))

2013-06-11 Thread Νικόλαος Κούρας
Τη Τρίτη, 11 Ιουνίου 2013 2:21:50 μ.μ. UTC+3, ο χρήστης Andreas Perstinger έγραψε: sending the mail to python-list@python.org will just open anew subject intead of replyign to an opened thread. You would need to find out the Message-Id of the post you want to reply to and then add

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Roel Schroeven
Peter Otten schreef: Fábio Santos wrote: On 10 Jun 2013 23:54, Roel Schroeven r...@roelschroeven.net wrote: You could do something like: new_songs, old_songs = [], [] [(new_songs if s.is_new() else old_songs).append(s) for s in songs] But I'm not sure that that's any better than the long

A certainl part of an if() structure never gets executed.

2013-06-11 Thread Νικόλαος Κούρας
[code] if not re.search( '=', name ) and not re.search( '=', month ) and not re.search( '=', year ): cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM clients WHERE name = %s) and MONTH(lastvisit) = %s and YEAR(lastvisit) = %s ORDER BY

Re: py_compile vs. built-in compile, with __future__

2013-06-11 Thread dhyams
On Tuesday, June 11, 2013 11:37:17 AM UTC-4, Neil Cerutti wrote: On 2013-06-10, dhyams dhy...@gmail.com wrote: On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote: Can you read the file into a string, prepend a future directive, and then compile the string?

Re: OT: e-mail reply to old/archived message

2013-06-11 Thread Andreas Perstinger
On 11.06.2013 22:14, Νικόλαος Κούρας wrote: Τη Τρίτη, 11 Ιουνίου 2013 2:21:50 μ.μ. UTC+3, ο χρήστης Andreas Perstinger έγραψε: sending the mail to python-list@python.org will just open anew subject intead of replyign to an opened thread. You would need to find out the Message-Id of the

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Mark Lawrence
On 11/06/2013 21:20, Νικόλαος Κούρας wrote: [code] if not re.search( '=', name ) and not re.search( '=', month ) and not re.search( '=', year ): cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM clients WHERE name = %s) and

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread MRAB
On 11/06/2013 21:20, Νικόλαος Κούρας wrote: [code] if not re.search( '=', name ) and not re.search( '=', month ) and not re.search( '=', year ): cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM clients WHERE name = %s) and

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Rick Johnson
Umm, Niko. (Superfluous Unicode Removed) The code you have written is very difficult to read because you are doing too much inside the conditional and you're repeating things!. For starters you could compile those regexps and re-use them: ## BEGIN SESSION ## py import re py s = \ ... hello.

ABOUT-MOBILES and Download Computer eBOOKs

2013-06-11 Thread friendpunjab
ABOUT-MOBILES and Download Computer eBOOKs http://allfree-stuff.com ABOUT-MOBILES http://allfree-stuff.com/indexsub.php?tcatid=8tcatname=ABOUT-MOBILES Android Mobiles HTC Mobiles Micromax Mobiles Mobile Articles Mobile Terms Nokia Mobiles Samsung Mobiles Sony Mobiles Tablets Download Computer

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread alex23
On Jun 12, 5:42 am, Νικόλαος Κούρας nikos.gr...@gmail.com wrote: Indeed as Andreas said i was overusing the form variable 'page' No. You're simply _not_ thinking about what you're doing. elif page or form.getvalue('show'):         # it is a python script         page = page else:        

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread alex23
On Jun 12, 6:20 am, Νικόλαος Κούρας nikos.gr...@gmail.com wrote: [code] http://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/ Hey, I have a problem, here is my code, you work it out is not a valid debugging technique. --

Re: Newbie: question regarding references and class relationships

2013-06-11 Thread Rick Johnson
On Monday, June 10, 2013 8:18:52 AM UTC-5, Rui Maciel wrote: [...] code class Point: position = [] def __init__(self, x, y, z = 0): self.position = [x, y, z] Firstly. Why would you define a Point object that holds it's x,y,z values in a list attribute? Why

Re: Newbie: question regarding references and class relationships

2013-06-11 Thread Rick Johnson
On Monday, June 10, 2013 2:56:15 PM UTC-5, Ian wrote: [...] There are a couple of ways you might get this to work the way you want. One is by adding as an extra layer a proxy object, which could be as simple as: class Proxy(object): def __init__(self, ref): self.ref = ref

Re: Build Python 2.7.5 - Modules missing

2013-06-11 Thread Walter Hurry
On Tue, 11 Jun 2013 16:18:58 -0500, Tony the Tiger wrote: On Mon, 10 Jun 2013 17:51:25 +, Walter Hurry wrote: On building Python 2.7.5 I got the following message: Python build finished, but the necessary bits to build these modules were not found: dl imageop

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Roy Smith
In article mailman.3032.1370971724.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Wed, Jun 12, 2013 at 1:28 AM, Serhiy Storchaka storch...@gmail.com wrote: 11.06.13 01:50, Chris Angelico написав(ла): On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Roy Smith
In article mailman.3023.1370964449.3114.python-l...@python.org, Serhiy Storchaka storch...@gmail.com wrote: 11.06.13 07:11, Roy Smith написав(ла): In article mailman.2992.1370904643.3114.python-l...@python.org, Roel Schroeven r...@roelschroeven.net wrote: new_songs, old_songs

Re: Split a list into two parts based on a filter?

2013-06-11 Thread alex23
On Jun 11, 9:08 am, Fábio Santos fabiosantos...@gmail.com wrote: On 10 Jun 2013 23:54, Roel Schroeven r...@roelschroeven.net wrote: new_songs, old_songs = [], [] [(new_songs if s.is_new() else old_songs).append(s) for s in songs] This is so beautiful! No, it's actually pretty terrible. It

Why doesn't nose see my plugin?

2013-06-11 Thread Roy Smith
I'm attempting to write a nose plugin. Nosetests (version 1.3.0) is not seeing it. I'm running python 2.7.3. The plugin itself is: mongo_reporter.py: import nose.plugins import logging log = logging.getLogger('nose.plugins.mongoreporter')

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread alex23
On Jun 12, 6:16 am, Νικόλαος Κούρας nikos.gr...@gmail.com wrote: I get the error that i cannot use 'replac'e to a 'list'. How can i avoid that? BY NOT USING STRING METHODS ON A LIST. Ulrich even *told* you what to do: convert it to a string yourself Do you do that in your code? No. Instead,

Re: OT: e-mail reply to old/archived message

2013-06-11 Thread nagia . retsina
How can i be able to answer you guys posts by my mail client? -- http://mail.python.org/mailman/listinfo/python-list

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread nagia . retsina
Τη Τετάρτη, 12 Ιουνίου 2013 1:43:21 π.μ. UTC+3, ο χρήστης MRAB έγραψε: On 11/06/2013 21:20, Νικόλαος Κούρας wrote: [code] if not re.search( '=', name ) and not re.search( '=', month ) and not re.search( '=', year ): cur.execute( '''SELECT * FROM

Re: Receing a form variable as a list instead of as a string

2013-06-11 Thread nagia . retsina
if page or form.getvalue('show') == 'log': # it is a python script page = page.replace( '/home/nikos/public_html/cgi-bin', '' ) elif page or form.getvalue('show') == 'stats': page = page.replace( '/home/nikos/public_html/cgi-bin', '' ) in the first if option page

Re: Why doesn't nose see my plugin?

2013-06-11 Thread alex23
On Jun 12, 10:54 am, Roy Smith r...@panix.com wrote: I'm attempting to write a nose plugin.  Nosetests (version 1.3.0) is not seeing it. setup(     entry_points = {         'nose.plugins.1.10': ['mongoreporter = mongo_reporter.MongoReporter'],         }, Hey Roy, I've never actually

Re: Why doesn't nose see my plugin?

2013-06-11 Thread Roy Smith
In article 69d4486b-d2ff-4830-b16e-f3f6ea73d...@kt20g2000pbb.googlegroups.com, alex23 wuwe...@gmail.com wrote: On Jun 12, 10:54 am, Roy Smith r...@panix.com wrote: I'm attempting to write a nose plugin.  Nosetests (version 1.3.0) is not seeing it. setup(     entry_points = {      

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Rick Johnson
On Tuesday, June 11, 2013 8:25:30 PM UTC-5, nagia@gmail.com wrote: is there a shorter and more clear way to write this? i didnt understood what Rick trie to told me. My example included verbatim copies of interactive sessions within the Python command line. You might understand them

Re: Why doesn't nose see my plugin?

2013-06-11 Thread alex23
On Jun 12, 11:43 am, Roy Smith r...@panix.com wrote: Just to see what would happen, I tried changing it to:     entry_points = {         'nose.plugins.1.3.0': ['mongoreporter = testing.nose.mongo_reporter.MongoReporter'],         }, didn't appear to make any difference. Yeah, reading some

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread MRAB
On 12/06/2013 02:25, nagia.rets...@gmail.com wrote: Τη Τετάρτη, 12 Ιουνίου 2013 1:43:21 π.μ. UTC+3, ο χρήστης MRAB έγραψε: On 11/06/2013 21:20, Νικόλαος Κούρας wrote: [snip] What are the values of 'name', 'month' and 'year' in each of the cases? Printing out ascii(name), ascii(month) and

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread alex23
On Jun 12, 11:46 am, Rick Johnson rantingrickjohn...@gmail.com wrote: Utilizing the power of interactive sessions, for learning and debugging, should be a cornerstone fundamental of your programming work-flow when writing code in an interpreted language like Python. Unfortunately with Ferrous,

Re: Do you consider Python a 4GL? Why (not)?

2013-06-11 Thread Dave Angel
On 06/11/2013 03:48 PM, Laurent Pointal wrote: Dennis Lee Bieber wrote: On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg drsali...@gmail.com declaimed the following in gmane.comp.python.general: SNIP The C compiler suites used this ability to read the error log from a compile, and

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Chris Angelico
On Wed, Jun 12, 2013 at 11:57 AM, alex23 wuwe...@gmail.com wrote: On Jun 12, 11:46 am, Rick Johnson rantingrickjohn...@gmail.com wrote: Utilizing the power of interactive sessions, for learning and debugging, should be a cornerstone fundamental of your programming work-flow when writing code

Re: Do you consider Python a 4GL? Why (not)?

2013-06-11 Thread Chris Angelico
On Wed, Jun 12, 2013 at 12:02 PM, Dave Angel da...@davea.name wrote: On 06/11/2013 03:48 PM, Laurent Pointal wrote: Dennis Lee Bieber wrote: On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg drsali...@gmail.com declaimed the following in gmane.comp.python.general: SNIP The C

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread alex23
On Jun 12, 12:05 pm, Chris Angelico ros...@gmail.com wrote: You have to include the coding phase. How else would he get into an error state? Via copy paste. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't nose see my plugin?

2013-06-11 Thread Roy Smith
In article 0d704515-46c9-486a-993c-ff5add3c9...@rh15g2000pbb.googlegroups.com, alex23 wuwe...@gmail.com wrote: On Jun 12, 11:43 am, Roy Smith r...@panix.com wrote: Just to see what would happen, I tried changing it to:     entry_points = {         'nose.plugins.1.3.0': ['mongoreporter

Re: Python Game Development?

2013-06-11 Thread alex23
On Jun 8, 1:53 am, letsplaysf...@gmail.com wrote: I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: • Cocos2D - Won't install and cant find any support Cocos2D is what I tend to recommend. What issues did you have with installing it? For

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Rick Johnson
On Tuesday, June 11, 2013 9:14:38 PM UTC-5, alex23 wrote: On Jun 12, 12:05 pm, Chris Angelico ros...@gmail.com wrote: You have to include the coding phase. How else would he get into an error state? Via copy paste. Now that's more like it Alex! If you move to my side the Python

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Rick Johnson
On Tuesday, June 11, 2013 10:37:39 PM UTC-5, Rick Johnson wrote: Now that's more like it Alex! Opps, it seems i falsely interpreted Chris's post as directed towards me, and then with that false assumption in mind i went on to falsely interpreted reply to Chris. Folks if your not already

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Michael Torrie
On 06/11/2013 02:20 PM, Νικόλαος Κούρας wrote: [code] if not re.search( '=', name ) and not re.search( '=', month ) and not re.search( '=', year ): What do each of these functions return? When you print out re.search('=', name) what happens? When you're debugging you should

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Michael Torrie
On 06/11/2013 10:49 PM, Michael Torrie wrote: --- my_cgi_script.py --- import do_something # handle cgi stuff # get name, month year dosomething.dosomething(name, month, year) Make that do_something.do_something --

Re: A certainl part of an if() structure never gets executed.

2013-06-11 Thread Tim Roberts
?? nikos.gr...@gmail.com wrote: [code] if not re.search( '=', name ) and not re.search( '=', month ) and not re.search( '=', year ): cur.execute( '''SELECT * FROM works WHERE clientsID = (SELECT id FROM clients WHERE name = %s) and

ValueError: I/O operation on closed file. with python3

2013-06-11 Thread Adam Mercer
Hi I'm trying to update one of my scripts so that it runs under python2 and python3, but I'm running into an issue that the following example illustrates: $ cat test.py try: # python-2.x from urllib2 import urlopen from ConfigParser import ConfigParser except ImportError: # python-3.x

  1   2   >