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

2013-06-11 Thread Phil Connell
On 12 Jun 2013 02:20, wrote: > > How can i be able to answer you guys posts by my mail client? Don't delete mails that you might want to reply to. If you do anything else, you're just making it difficult for yourself. Cheers, Phil > -- > http://mail.python.org/mailman/listinfo/python-list --

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

2013-06-11 Thread Phil Connell
On 12 Jun 2013 01:36, "Roy Smith" wrote: > > In article , > Serhiy Storchaka wrote: > > > 11.06.13 07:11, Roy Smith написав(ла): > > > In article , > > > Roel Schroeven wrote: > > > > > >> new_songs, old_songs = [], [] > > >> [(new_songs if s.is_new() else old_songs).append(s) for s in songs]

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

2013-06-11 Thread alex23
On Jun 12, 3:44 pm, Tim Roberts wrote: > It seems silly to fire up a regular expression compiler to look for a > single character. >     if name.find('=') < 0 and month.find('=') < 0 and year.find('=') < 0: If truthiness is the only concern, I prefer using `in`: if '=' in name and '=' in mon

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

2013-06-11 Thread Steven D'Aprano
On Tue, 11 Jun 2013 18:29:05 -0700, nagia.retsina wrote: > 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/niko

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 f

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

2013-06-11 Thread Tim Roberts
?? 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 MONTH(lastvisit) = %s and

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 -- http://mail.python.org/mailman/listinfo/pytho

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 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 igno

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 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 world could

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 suppo

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 wrote: > On Jun 12, 11:43 am, Roy Smith wrote: > > Just to see what would happen, I tried changing it to: > > > >     entry_points = { > >         'nose.plugins.1.3.0': ['mongoreporter = > > testing.nose.mo

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

2013-06-11 Thread alex23
On Jun 12, 12:05 pm, Chris Angelico 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: 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 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 >>> declaimed the following in gmane.comp.python.general: >>> >>> >> >> >>> The C compiler suites used

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 wrote: > On Jun 12, 11:46 am, Rick Johnson > 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 Pyth

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 declaimed the following in gmane.comp.python.general: The C compiler suites used this ability to read the error log from a compile, and move to the line/column in

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

2013-06-11 Thread alex23
On Jun 12, 11:46 am, Rick Johnson 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, the process is more lik

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 asci

Re: Why doesn't nose see my plugin?

2013-06-11 Thread alex23
On Jun 12, 11:43 am, Roy Smith 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 more i

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 bett

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 wrote: > On Jun 12, 10:54 am, Roy Smith wrote: > > I'm attempting to write a nose plugin.  Nosetests (version 1.3.0) is not > > seeing it. > > > > setup( > > >     entry_points = { > >         'nose.plugin

Re: Why doesn't nose see my plugin?

2013-06-11 Thread alex23
On Jun 12, 10:54 am, Roy Smith 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 written a

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 work

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

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: Receing a form variable as a list instead of as a string

2013-06-11 Thread alex23
On Jun 12, 6:16 am, Νικόλαος Κούρας 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, you assign a value

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') clas

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 wrote: > On 10 Jun 2013 23:54, "Roel Schroeven" 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 creates a list in order to populate _t

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

2013-06-11 Thread Roy Smith
In article , Serhiy Storchaka wrote: > 11.06.13 07:11, Roy Smith написав(ла): > > In article , > > Roel Schroeven 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 tr

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

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

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 imag

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: 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: > [...] > > > 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? W

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

2013-06-11 Thread alex23
On Jun 12, 6:20 am, Νικόλαος Κούρας 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. -- http://mail.python.org/mailman/listinfo/python-list

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

2013-06-11 Thread alex23
On Jun 12, 5:42 am, Νικόλαος Κούρας 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: >         #when everything

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=8&tcatname=ABOUT-MOBILES Android Mobiles HTC Mobiles Micromax Mobiles Mobile Articles Mobile Terms Nokia Mobiles Samsung Mobiles Sony Mobiles Tablets Download Computer

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 = """\ ... hel

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 MONTH(lastv

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 MONTH(lastv

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 p

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 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? > > > > >

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: 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" 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 so be

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 m

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

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 :-) -- http://

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 > 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 (the Amiga

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: 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 >> wrote: >>> 11.06.13 01:50, Chris Angelico написав(ла): >>> On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith wrote: > > new_songs = [s for

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 pre

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 > wrote: >> 11.06.13 01:50, Chris Angelico написав(ла): >> >>> On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith wrote: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not s.is_new()]

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

2013-06-11 Thread rusi
On Jun 11, 10:37 pm, Chris Angelico wrote: > On Wed, Jun 12, 2013 at 3:23 AM, rusi wrote: > > On Jun 11, 10:05 pm, Fábio Santos wrote: > >> On 11 Jun 2013 17:47, "rusi" 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" wrote: > > On Wed, Jun 12, 2013 at 3:23 AM, rusi wrote: > > On Jun 11, 10:05 pm, Fábio Santos wrote: > >> On 11 Jun 2013 17:47, "rusi" wrote: > >> > >> > [Of course I would prefer a 3-liner where the body of the for is > >> > indented :-) ] > >> > >> Is th

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 wrote: > On Jun 11, 10:05 pm, Fábio Santos wrote: >> On 11 Jun 2013 17:47, "rusi" wrote: >> >> > [Of course I would prefer a 3-liner where the body of the for is >> > indented :-) ] >> >> Is this an aside comprehension? > > Eh? I know they always say "don't

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 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 -- http://mail.python.org/mailman/listinfo/python-list

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 wrote: > On 11 Jun 2013 17:47, "rusi" 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: (new_songs if s.is_new() else old_songs).a

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 wrote: > 11.06.13 01:50, Chris Angelico написав(ла): > >> On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith 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? >

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:57 AM, Eam onn 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 years and noth

Re: PYTHONPATH: dev and prod

2013-06-11 Thread rusi
On Jun 11, 9:28 pm, jacopo 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: > /prod/myscripts > /p

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 tutori

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:56 AM, Eam onn 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 available on the pyg

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

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 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 mov

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 moveme

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 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 as Roy's original. n

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

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. L

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

2013-06-11 Thread Grant Edwards
On 2013-06-11, Mark Janssen 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, shouldn't i

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 9:47 AM, 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 pi

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 look

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 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 tra

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

2013-06-11 Thread Neil Cerutti
On 2013-06-10, dhyams 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 back t

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 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 songs if s.is_new

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 , Roel Schroeven 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 figure out what list gets created and discarded. I think it's [None] * le

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 i

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 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 patched) f

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

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" 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] > >> > >

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

[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: 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 , referer: http://xxxredactedxxx/ page = page.replace( '/home/nikos/public_html/', '' ), referer: http://xxxredactedxxx/ AttributeError: 'list' object has no attribute 'replace', ref

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

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 Mini

Re: Build Python 2.7.5 - Modules missing

2013-06-11 Thread rusi
On Jun 10, 10:51 pm, 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            linuxaudiodev > spwd               sunaudiodev > To find the necessar

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 oth

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 ar

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

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( months.valu

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 orig

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 this...

Re: Popen and reading stdout in windows

2013-06-11 Thread Chris Rebert
On Jun 11, 2013 12:21 AM, "Pete Forman" wrote: > > "Joseph L. Casale" 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 a

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 m

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: Popen and reading stdout in windows

2013-06-11 Thread Pete Forman
"Joseph L. Casale" 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 I have sent > s

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 > cod

  1   2   >