Re: pygame: output to file?

2012-04-16 Thread superpollo
superpollo ha scritto: alex23 ha scritto: On Apr 16, 7:34 pm, superpollo wrote: is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... There is, but it's probably not going to

Re: pygame: output to file?

2012-04-16 Thread superpollo
alex23 ha scritto: On Apr 16, 7:34 pm, superpollo wrote: is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... There is, but it's probably not going to be as performant as

pygame: output to file?

2012-04-16 Thread superpollo
HI. is there a way to convert the graphical output of a pygame application to a mpeg file or better an animated gif? i mean, not using an external capture program... bye -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - parsing MIME(?) strings

2010-10-28 Thread superpollo
Dan M ha scritto: On Thu, 28 Oct 2010 15:05:56 -0500, Dan M wrote: Ok, I didn't research enough before I posted this. I see now that this *is* indeed a MIME message, and the '?Q' bit says that the next piece is quoted-printable, and that the encoding is defined in RFC2047. So the question th

Re: automate minesweeper with python

2010-07-02 Thread superpollo
Ethan Furman ha scritto: Terry Reedy wrote: On 7/1/2010 6:42 PM, Emile van Sebille wrote: On 7/1/2010 2:52 PM Jay said... pywinauto looks to be almost perfect. All I need now is to read the numbers uncovered when a minesweeper square is clicked on, or that I just hit a mine. ... or, you c

Re: python source code -> win/dos executable (on linux)

2010-06-28 Thread superpollo
Lawrence D'Oliveiro ha scritto: In message <4c24c152$0$31381$4fafb...@reader1.news.tin.it>, superpollo wrote: suppose i work in a linux environment, but i would like to ship a win/dos executable file from time to time, just for test purposes (my "testers" are windows us

python source code -> win/dos executable (on linux)

2010-06-25 Thread superpollo
hi. suppose i work in a linux environment, but i would like to ship a win/dos executable file from time to time, just for test purposes (my "testers" are windows users and don't want to go through the hassle of installing python on their win boxes). what is the best way to do that? (the appli

Re: pythonize this!

2010-06-15 Thread superpollo
Paul Rubin ha scritto: superpollo writes: goal (from e.c.m.): evaluate 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three consecutive + must be followed by two - (^ meaning ** in this context) print sum([-1,1,1,1,-1][i%5]*i**2 for i in xrange(1,2011)) beautiful. thx

Re: pythonize this!

2010-06-15 Thread superpollo
Stefan Behnel ha scritto: superpollo, 15.06.2010 14:55: Peter Otten ha scritto: superpollo wrote: goal (from e.c.m.): evaluate 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three consecutive + must be followed by two - (^ meaning ** in this context) from itertools import

Re: GUIs - A Modest Proposal

2010-06-15 Thread superpollo
lkcl ha scritto: ... That sounds too good to be true. yup, it does. how can one person, a free software developer, have come up with something like "The Holy Grail" of software development, right? when all the money in the world, from ibm, adobe, microsoft, google, nokia and so on _hasn't_ m

Re: pythonize this!

2010-06-15 Thread superpollo
superpollo ha scritto: Peter Otten ha scritto: superpollo wrote: goal (from e.c.m.): evaluate 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three consecutive + must be followed by two - (^ meaning ** in this context) from itertools import cycle, izip sum(sign*i*i for sign

Re: pythonize this!

2010-06-15 Thread superpollo
Peter Otten ha scritto: superpollo wrote: goal (from e.c.m.): evaluate 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three consecutive + must be followed by two - (^ meaning ** in this context) from itertools import cycle, izip sum(sign*i*i for sign, i in izip(cycle([1]*3

Re: pythonize this!

2010-06-15 Thread superpollo
Ulrich Eckhardt ha scritto: superpollo wrote: ... s += i**2 ... if not (i+1)%5: ... s -= 2*i**2 ... if not i%5: ... s -= 2*i**2 if not (i % 5) in [1, 2]: s += i**2 else: s -= i**2 Untested code. does not work: >>> s = 0 >>> for

pythonize this!

2010-06-15 Thread superpollo
goal (from e.c.m.): evaluate 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three consecutive + must be followed by two - (^ meaning ** in this context) my solution: >>> s = 0 >>> for i in range(1, 2011): ... s += i**2 ... if not (i+1)%5: ... s -= 2*i**2 ...

Re: a +b ?

2010-06-11 Thread superpollo
Simon Brunning ha scritto: 2010/6/11 yanhua : hi,all! it's a simple question: input two integers A and B in a line,output A+B? print sum(int(i) for i in raw_input("Please enter some integers: ").split()) LOL -- http://mail.python.org/mailman/listinfo/python-list

Re: a +b ?

2010-06-11 Thread superpollo
yanhua ha scritto: hi,all?? it's a simple question: input two integers A and B in a line,output A+B? this is my program: s = input() this does not work t = s.split() a = int(t[0]) b = int(t[1]) print(a+b) but i think it's too complex,can anybody tell to slove it with less code. >>> import

Re: GUIs - A Modest Proposal

2010-06-11 Thread superpollo
Andreas Waldenburger ha scritto: On Thu, 10 Jun 2010 23:00:37 -0700 (PDT) rantingrick wrote: On Jun 11, 12:17 am, ant wrote: I like the points about backwards compatibility. Presumably that reason alone is enough to keep Tkinter in the standard library for a long while. I don't see why that

Re: Reading file bit by bit

2010-06-07 Thread superpollo
Ulrich Eckhardt ha scritto: Peter Otten wrote: Ulrich Eckhardt wrote: Says Python: bin(192) '0x1100' Hmm, if that's what /your/ Python says, here's mine to counter: bin(192) '0_totally_faked_binary_0011' Argh! Of course one of my Pythons says '0b1100' and not what I mistype

Re: Creating a single list

2010-05-29 Thread superpollo
Astley Le Jasper ha scritto: This is probably a really silly question but, given the example code at the bottom, how would I get a single list? What I currently get is: ('id', 20, 'integer') ('companyname', 50, 'text') [('focus', 30, 'text'), ('fiesta', 30, 'text'), ('mondeo', 30, 'text'), ('pu

Re: function that counts...

2010-05-25 Thread superpollo
Jean-Michel Pichavant ha scritto: superpollo wrote: Jean-Michel Pichavant ha scritto: Jerry Hill wrote: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it?

Re: function that counts...

2010-05-24 Thread superpollo
Jean-Michel Pichavant ha scritto: Jerry Hill wrote: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it? This is how I would do it: def prttn(m, n): "

Re: function that counts...

2010-05-20 Thread superpollo
Grant Edwards ha scritto: On 2010-05-20, superpollo wrote: Steven D'Aprano ha scritto: On Wed, 19 May 2010 21:58:04 +0200, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): Does the name "prttn" mean anythin

Re: function that counts...

2010-05-20 Thread superpollo
Peter Pearson ha scritto: On Wed, 19 May 2010 21:58:04 +0200, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: If it's important for the function to execute quickly for large n, you might get a useful speedup by testing only every ninth in

Re: function that counts...

2010-05-20 Thread superpollo
Richard Thomas ha scritto: For this kind of problem you should avoid all that stringification. I find it best to deal with sequences of digits of a fixed length and go from there. For example: def count1(m, n, cache={}): """Number of digit sequences of length `n` summing to `m`.""" if n

Re: function that counts...

2010-05-20 Thread superpollo
Steven D'Aprano ha scritto: On Wed, 19 May 2010 21:58:04 +0200, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): Does the name "prttn" mean anything? I'm afraid I keep reading it as a mispelling of &q

Re: function that counts...

2010-05-20 Thread superpollo
Steven D'Aprano ha scritto: On Wed, 19 May 2010 22:58:22 +0200, superpollo wrote: In [266]: del(sum) del is a statement, not a function, so the brackets are pointless. This is like writing: x = (1) instead of x = 1 `del sum` is all you need. sorry about that, thanks a lot!

Re: function that counts...

2010-05-19 Thread superpollo
Mark Dickinson ha scritto: On May 19, 9:30 pm, superpollo wrote: René 'Necoro' Neumann ha scritto: An idea would be: def prttn(m, n): ...return sum(1 for x in range(n) if sum(map(int, str(x))) == m) TypeError: 'int' object is not callable on 2.5.4 The

Re: function that counts...

2010-05-19 Thread superpollo
Jerry Hill ha scritto: On Wed, May 19, 2010 at 4:25 PM, superpollo wrote: Jerry Hill ha scritto: sumofdigits = sum(int(char) for char in str(testval)) this line gives me this: TypeError: 'int' object is not callable is it some new feature in >2.5 ? No, sum() has b

Re: function that counts...

2010-05-19 Thread superpollo
René 'Necoro' Neumann ha scritto: Am 19.05.2010 21:58, schrieb superpollo: ... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): tot = 0 for i in range(n): s = str(i) sum = 0 for j in range(len(s)):

Re: function that counts...

2010-05-19 Thread superpollo
Jerry Hill ha scritto: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it? This is how I would do it: def prttn(m, n): """How many positive integers les

Re: ipython question

2010-05-19 Thread superpollo
superpollo ha scritto: Robert Kern ha scritto: On 5/19/10 12:11 PM, superpollo wrote: In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... You will want to ask IPython questions on the IPython mailing list: http

Re: ipython question

2010-05-19 Thread superpollo
Robert Kern ha scritto: On 5/19/10 12:11 PM, superpollo wrote: In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... You will want to ask IPython questions on the IPython mailing list: http://mail.scipy.org/mailman

function that counts...

2010-05-19 Thread superpollo
... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): tot = 0 for i in range(n): s = str(i) sum = 0 for j in range(len(s)): sum += int(s[j]) if sum == m: tot += 1 return tot .:

ipython question

2010-05-19 Thread superpollo
In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... -- http://mail.python.org/mailman/listinfo/python-list

Re: remove elements incrementally from a list

2010-05-19 Thread superpollo
Javier Montoya ha scritto: Dear all, I've a list of float numbers and I would like to delete incrementally a set of elements in a given range of indexes, sth. like: for j in range(beginIndex, endIndex+1): print ("remove [%d] => val: %g" % (j, myList[j])) del myList[j] However, since I'm

Re: recall function definition from shell

2010-05-18 Thread superpollo
Peter Otten ha scritto: superpollo wrote: Patrick Maupin ha scritto: On May 18, 1:41 pm, superpollo wrote: Patrick Maupin ha scritto: On May 18, 12:31 pm, superpollo wrote: >>> def myfun(): ... return "WOW" ... >>> myfun() 'WOW' now, i would

Re: recall function definition from shell

2010-05-18 Thread superpollo
Patrick Maupin ha scritto: On May 18, 1:41 pm, superpollo wrote: Patrick Maupin ha scritto: On May 18, 12:31 pm, superpollo wrote: >>> def myfun(): ... return "WOW" ... >>> myfun() 'WOW' now, i would like to "list&q

Re: recall function definition from shell

2010-05-18 Thread superpollo
Patrick Maupin ha scritto: On May 18, 12:31 pm, superpollo wrote: >>> def myfun(): ... return "WOW" ... >>> myfun() 'WOW' >>> now, i would like to "list" the funcion definition, something like this: >>> myfun.something

recall function definition from shell

2010-05-18 Thread superpollo
>>> def myfun(): ... return "WOW" ... >>> myfun() 'WOW' >>> now, i would like to "list" the funcion definition, something like this: >>> myfun.somethinglikethis() def myfun(): return "WOW" >>> is there something like this around? bye -- http://mail.python.org/mailman/listinfo/python-li

Re: reading XML file using python

2010-05-17 Thread superpollo
Simon Brunning ha scritto: On 17 May 2010 09:34:51 UTC+1, shanti bhushan wrote: Hi , i am new to python.i want to read the XML file using python it ,by using DOm or SAX any of them. I want to read the http://www.google.com(any hyper text) from XML and print that. please give me the sample progr

Re: Updating values in a dictionary

2010-05-16 Thread superpollo
Thomas ha scritto: Greetings I am having a darn awful time trying to update a matrix: row = dict([(x,0) for x in range(3)]) matrix = dict([(x,row) for x in range(-3,4,1)]) matrix[2][1] += 1 matrix[-1][2] += 1 """ Got: a 1 in all col 1 and 2 {-3: {0: 0, 1: 1, 2: 1}, -2: {0: 0, 1: 1, 2: 1}, -

Re: parsing XML

2010-05-15 Thread superpollo
superpollo ha scritto: kak...@gmail.com ha scritto: Hi to all, let's say we have the following Xml 17.1 6.4 15.5 7.8 How can i get the players name, age and height? DOM or SAX and how Thanks Antonis another minimal xml.etree.ElementTree solution: >

Re: parsing XML

2010-05-15 Thread superpollo
kak...@gmail.com ha scritto: Hi to all, let's say we have the following Xml 17.1 6.4 15.5 7.8 How can i get the players name, age and height? DOM or SAX and how Thanks Antonis another minimal xml.etree.ElementTree solution: >>> print document 17.1 6.

Re: Human word reader

2010-05-15 Thread superpollo
superpollo ha scritto: timo verbeek ha scritto: I'm planning to create a human word program A human inputs a string "Give me the weather for London please." Then I will strip the string. "weather for london" Then I get the useful information. what:"weather"

Re: Human word reader

2010-05-15 Thread superpollo
timo verbeek ha scritto: I'm planning to create a human word program A human inputs a string "Give me the weather for London please." Then I will strip the string. "weather for london" Then I get the useful information. what:"weather" where:"london" After that I use the info. I need help with ge

Re: Data store solution need help

2010-05-14 Thread superpollo
Haulyn Jason ha scritto: Hi, all: I am a Java programmer, now I am working on a Python program. At the moment, I need to store some data from user's input, no database, no xml, no txt(we can not make users open the data file by vim or other text editor). security thru obscurity? mmmhhh... -

Re: Extract all words that begin with x

2010-05-12 Thread superpollo
Stefan Behnel ha scritto: superpollo, 11.05.2010 17:03: Aahz ha scritto: In article , Terry Reedy wrote: On 5/10/2010 5:35 AM, James Mills wrote: On Mon, May 10, 2010 at 6:50 PM, Xavier Ho wrote: Have I missed something, or wouldn't this work just as well: list_of_strings = ['

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread superpollo
James Mills ha scritto: On Wed, May 12, 2010 at 2:01 AM, wrote: word[len(word)-1:] This works just as well: word[-1:] d'uh. ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over dict and removing some elements

2010-05-11 Thread superpollo
superpollo ha scritto: Ulrich Eckhardt ha scritto: Hi! I wrote a simple loop like this: d = {} ... for k in d: if some_condition(d[k]): d.pop(k) If I run this, Python complains that the dictionary size changed during iteration. I understand that the iterator relies on

Re: Iterating over dict and removing some elements

2010-05-11 Thread superpollo
Ulrich Eckhardt ha scritto: Hi! I wrote a simple loop like this: d = {} ... for k in d: if some_condition(d[k]): d.pop(k) If I run this, Python complains that the dictionary size changed during iteration. I understand that the iterator relies on the internal structure not

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread superpollo
pyt...@bdurham.com ha scritto: Terry, ... word[0:1] does the same thing. All Python programmers should learn to use slicing to extract a char from a string that might be empty. Is there an equivalent way to slice the last char from a string (similar to an .endswith) that doesn't raise an ex

Re: Extract all words that begin with x

2010-05-11 Thread superpollo
Aahz ha scritto: In article , Terry Reedy wrote: On 5/10/2010 5:35 AM, James Mills wrote: On Mon, May 10, 2010 at 6:50 PM, Xavier Ho wrote: Have I missed something, or wouldn't this work just as well: list_of_strings = ['2', 'awes', '3465sdg', 'dbsdf', 'asdgas'] [word for word in list_of_

Re: Extract all words that begin with x

2010-05-10 Thread superpollo
superpollo ha scritto: Jimbo ha scritto: Hello I am trying to find if there is a string OR list function that will search a list of strings for all the strings that start with 'a' & return a new list containing all the strings that started with 'a'. I have had a s

Re: Extract all words that begin with x

2010-05-10 Thread superpollo
Jimbo ha scritto: Hello I am trying to find if there is a string OR list function that will search a list of strings for all the strings that start with 'a' & return a new list containing all the strings that started with 'a'. I have had a search of Python site & I could not find what I am look

solve a newspaper quiz

2010-05-09 Thread superpollo
"if a b c are digits, solve ab:c=a*c+b" solved in one minute with no thought: for a in range(10): for b in range(10): for c in range(10): try: if (10.*a+b)/c==a*c+b: print "%i%i:%i=%i*%i+%i" % (a,b,c,a,c,b) except:

Re: Kindly show me a better way to do it

2010-05-08 Thread superpollo
Oltmans ha scritto: On May 9, 1:53 am, superpollo wrote: add = lambda a,b: a+b for i in reduce(add,a): print i This is very neat. Thank you. Sounds like magic to me. Can you please explain how does that work? Many thanks again. here: http://tinyurl.com/3xp and here: http

Re: Kindly show me a better way to do it

2010-05-08 Thread superpollo
superpollo ha scritto: Oltmans ha scritto: Hi, I've a list that looks like following a = [ [1,2,3,4], [5,6,7,8] ] Currently, I'm iterating through it like for i in [k for k in a]: for a in i: i think you used te a identifier for two meanings... print a but I was wo

Re: Kindly show me a better way to do it

2010-05-08 Thread superpollo
Oltmans ha scritto: Hi, I've a list that looks like following a = [ [1,2,3,4], [5,6,7,8] ] Currently, I'm iterating through it like for i in [k for k in a]: for a in i: i think you used te a identifier for two meanings... print a but I was wondering if there is a s

Re: Teaching Programming

2010-05-05 Thread superpollo
Martin P. Hellwig ha scritto: On 05/04/10 12:59, superpollo wrote: Martin P. Hellwig ha scritto: For the corner cases (I can think of a couple) it is good to know you can use ';' most of the time. most but not always as i noted (think about loops or function definition) Well

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC

Re: Teaching Programming

2010-05-04 Thread superpollo
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type

Re: Teaching Programming

2010-05-04 Thread superpollo
superpollo ha scritto: Stefan Behnel ha scritto: superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? ok,

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 14:46: my template system wants the input to generate the code to stay on a single line ( don't ask :-( ) I hope you don't mind if I still ask. What are you generating and for what templating system? ok, since you asked for i

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 13:56: Stefan Behnel ha scritto: The question is: why do you have to generate the above code in the first place? Isn't a function enough that does the above? of course! *but* if i must generate on-the-fly python code that defines a fun

Re: Teaching Programming

2010-05-04 Thread superpollo
James Mills ha scritto: On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: of course! *but* if i must generate on-the-fly python code that defines a function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type

Re: Teaching Programming

2010-05-04 Thread superpollo
Martin P. Hellwig ha scritto: On 05/04/10 11:28, superpollo wrote: Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. there might be problems if for example you generate code from a one-line template. Well a one

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 13:23: Stefan Behnel ha scritto: the main reason why this problem doesn't hurt much in Python is that Python is a dynamic language that can get you extremely far without generating code. It's simply not necessary in most cases, so pe

Re: Teaching Programming

2010-05-04 Thread superpollo
Stefan Behnel ha scritto: superpollo, 04.05.2010 12:28: i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. there might be problems if for example you generate code from a one-line

Re: Teaching Programming

2010-05-04 Thread superpollo
Samuel Williams ha scritto: I personally like indentation. I just wonder whether it is an issue that some people will dislike. i think there is an issue if you -- say -- produce python code, from within another programming environment, to be executed on the fly, at least in some instances. t

Re: Python script error when using print

2010-04-06 Thread superpollo
Robbie ha scritto: Hi all, So, I'm trying to use Python with an apache2 server to create some web pages. The web server is configured and seems to work correctly, but only with a certain type of script. For instance, this script works fine #!/usr/bin/env python def index(): s = "Hello Wor

Re: Recommend Commercial graphing library

2010-04-06 Thread superpollo
Grant Edwards ha scritto: On 2010-04-06, Grant Edwards wrote: On 2010-04-06, Jean-Michel Pichavant wrote: Pablo Recio Quijano wrote: Why must be commercial, when there is open and free alternatives? Like GNU Plot. Gnuplot is ugly. I'm using it because I don't care if it's ugly but it clearl

Re: pythonrag

2010-04-05 Thread superpollo
Jason Friedman ha scritto: I saw this posted in the July issue but did not see any follow-up there: $ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. a = 500 b = 500 a == b True a is b False

Re: off topic but please forgive me me and answer

2010-04-04 Thread superpollo
rantingrick ha scritto: On Apr 1, 3:44 pm, superpollo wrote: how much is one half times one half? This is amazing, how can such an off topic post based completely on lunacy exist so long here? 54 posts and counting. I think i had this very argument in grade school. We have SD'A, Tim

Re: off topic but please forgive me me and answer

2010-04-03 Thread superpollo
Patrick Maupin ha scritto: On Apr 3, 8:00 am, superpollo wrote: sorry if I misunderstood. no no you understood prfectly *but* the thing is i am a regular in an italian language math ng which is haunted by a crackpot who insists that 1/2 * 1/2 cannot be 1/4, "because multiplication

Re: off topic but please forgive me me and answer

2010-04-03 Thread superpollo
Mensanator ha scritto: On Apr 3, 8:00 am, superpollo wrote: Patrick Maupin ha scritto: On Apr 2, 2:41 pm, Andreas Waldenburger wrote: While everyone else is mocking you: Can you please elaborate on why you want to know and what kind of problem you're trying to solve with this?

Re: off topic but please forgive me me and answer

2010-04-03 Thread superpollo
Steve Holden ha scritto: superpollo wrote: Patrick Maupin ha scritto: On Apr 2, 2:41 pm, Andreas Waldenburger wrote: While everyone else is mocking you: Can you please elaborate on why you want to know and what kind of problem you're trying to solve with this? Also, don't you

Re: off topic but please forgive me me and answer

2010-04-03 Thread superpollo
Patrick Maupin ha scritto: On Apr 2, 2:41 pm, Andreas Waldenburger wrote: While everyone else is mocking you: Can you please elaborate on why you want to know and what kind of problem you're trying to solve with this? Also, don't you think you should have picked a maths forum for this kind of

off topic but please forgive me me and answer

2010-04-01 Thread superpollo
how much is one half times one half? -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Data Plotting Library DISLIN 10.0

2010-01-19 Thread superpollo
Helmut Michels ha scritto: Dear Pytnon users, I am pleased to announce version 10.0 of the data plotting software DISLIN. why dont you make it free software (i mean. GPL'ed) bye -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a list compression in Python?

2010-01-18 Thread superpollo
Kit ha scritto: Hello Everyone, I am not sure if I have posted this question in a correct board. Can anyone please teach me: What is a list compression in Python? Would you mind give me some list compression examples? Thanks & really appreciate that. Kit i think that's compreHENsion... htt

not and is not problem

2010-01-18 Thread superpollo
hi: #!/usr/bin/env python data = "seq=123" name , value = data.split("=") print name print value if not name == "seq": print "DOES NOT PRINT OF COURSE..." if name is not "seq": print "WTF! WHY DOES IT PRINT?" help please. bye -- http://mail.python.org/mailman/listinfo/python-list

Re: substitution

2010-01-18 Thread superpollo
it looked simpler when i posted, but i realize that the problem is non trivial. thanks to everybody. i guess that the algorithm would be easier if it was known in advance that the string to substitute must have some specific property, say: 1) they all must start with "XYZ" 2) they all have t

substitution

2010-01-18 Thread superpollo
hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye -- http://mail.python.org/mailman/listinfo/python-list

Re: substitution

2010-01-18 Thread superpollo
superpollo ha scritto: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye i explain better: say the subs are: quuux --> foo foo --> bar baz -->

Re: simple cgi program

2010-01-17 Thread superpollo
D'Arcy J.M. Cain ha scritto: On Sun, 17 Jan 2010 15:15:12 +0100 superpollo wrote: hi clp. i would like to submit the following code for review. it is a simple common gateway interface program, which uses the least possible libraries for the sake of mechanism undertanding. Why not jus

simple cgi program

2010-01-17 Thread superpollo
hi clp. i would like to submit the following code for review. it is a simple common gateway interface program, which uses the least possible libraries for the sake of mechanism undertanding. the third option in the firts conditional is for commandline testing. bye. code follows as: #

reading a text file

2009-08-19 Thread superpollo
hi clp what's the difference between: while True: input_line = sys.stdin.readline() if input_line: sys.stdout.write(input_line.upper()) else: break and: while True: try: sys.stdout.write(sys.stdin.next().upper()) except StopIteration

Re: possible to round number and convert to string?

2009-07-31 Thread superpollo
Dr. Phillip M. Feldman wrote: I'd like to be able to convert a float to a string representation in which the number is rounded to a specified number of digits. If num2str is a hypothetical function that does this, then num2str(pi,3) would be '3.142' (not '3.141'). I've been told that there is n

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
MRAB wrote: superpollo wrote: ... how to reverse a string in python? must i usa a temp? like: >>> s = "ciccio" >>> l = list(s) >>> l.reverse() >>> s = "".join(l) >>> s 'oiccic' >>> ??? Use sl

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
Tim Rowe wrote: 2009/7/30 r : Like your first lay, your first programing language can leave an indelible mark on you That's true. FOCAL scarred me for life. but i now realize Ruby has some good things going for it. Any language that gets any sort of real use has to have. For instance,

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
r wrote: On Jul 30, 12:15 pm, Masklinn wrote: [snip] Furthermore Ruby has a pretty nice convention (sadly not used enough I think) taken from Scheme where it's possible to postfix a method name with "!" (note: the "!" is part of the name, there's no magic) to indicate that this method mod

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
Masklinn wrote: ... That's an interesting point, but not relevant at the end of the day: `foo.length` and `length(foo)` have the same "practicality". On the other hand Ruby can be praised for the coherence: everything's a method period end of the story; while Python does have a dichotomy be

Re: idiom for list looping

2009-07-29 Thread superpollo
MRAB wrote: Xavier Ho wrote: superpollo wrote: for (i, e) in enumerate(nomi): print i, "-", e Just to be random: print '\n'.join(["%s - %s" % (i, e) for i, e in enumerate(nomi)]) This has one advantage: only print once. So it's sli

idiom for list looping

2009-07-29 Thread superpollo
hi clp. i want to get from here: nomi = ["one", "two", "three"] to here: 0 - one 1 - two 2 - three i found two ways: first way: for i in range(len(nomi)): print i, "-", nomi[i] or second way: for (i, e) in enumerate(nomi): print i, "-", e which one is "better"? is there a more py

Re: Extract images from PDF files

2009-07-28 Thread superpollo
David Lyon wrote: pdftohtml on sourceforge may help... also see: http://linuxcommand.org/man_pages/pdfimages1.html bye -- http://mail.python.org/mailman/listinfo/python-list

Re: pack an integer into a string

2009-07-24 Thread superpollo
Piet van Oostrum wrote: ... You have the string wrong. oops yea. But the correct one you get with: In [67]: import struct In [68]: number = 252509952 In [69]: struct.pack('>I', number) Out[69]: '\x0f\x0c\xff\x00' (Please note that this is big endian) thanks a lot, but it does not work f

Re: pack an integer into a string

2009-07-24 Thread superpollo
superpollo wrote: Sebastian Bassi wrote: On Fri, Jul 24, 2009 at 7:28 PM, superpollo wrote: is there a pythonic and synthetic way (maybe some standard module) to "pack" an integer (maybe a *VERY* big one) into a string? like this: What do you mean to pack? Maybe Pickle is wha

Re: pack an integer into a string

2009-07-24 Thread superpollo
Sebastian Bassi wrote: On Fri, Jul 24, 2009 at 7:28 PM, superpollo wrote: is there a pythonic and synthetic way (maybe some standard module) to "pack" an integer (maybe a *VERY* big one) into a string? like this: What do you mean to pack? Maybe Pickle is what you want. impo

pack an integer into a string

2009-07-24 Thread superpollo
is there a pythonic and synthetic way (maybe some standard module) to "pack" an integer (maybe a *VERY* big one) into a string? like this: >>> number = 252509952 >>> hex(number) '0xf0cff00' >>> so i would like a string like '\xf0\xcf\xf0\x00' i wrote some code to do it, so ugly i am ashame

  1   2   >