Re: cStringIO.StringIO has no write method?

2006-07-25 Thread Alexis Roda
En/na Laszlo Nagy ha escrit: > This program: > > import sys > import traceback > import cStringIO > > a = 1.0 > b = 0.0 > try: >c=a/b > except: f = cStringIO.StringIO('') >ei = sys.exc_info() >traceback.print_exception(ei[0],ei[1],ei[2],file=f) from cStringIO documentation:

Re: Quick Question

2006-06-22 Thread Alexis Roda
En/na xkenneth ha escrit: > I want to be able to cycle through an array and print something in > hexadecimal. Such as this > thisArray = ["AF","0F","5F"] > for x in range(len(thisArray)): >print "\x" + thisArray[x] > > However python chokes on the escaped identifier, how can I get arou

Re: add elements to indexed list locations

2006-06-16 Thread Alexis Roda
En/na [EMAIL PROTECTED] ha escrit: > Hi, > > I have a very simple problem, but do not know an elegant way to > accomplish this. > ### > # I have a list of names: > names = ['clark', 'super', 'peter', 'spider', 'bruce', 'bat'] > > # and another set of names that I want to insert into > # the names

Re: integer to binary...

2006-06-01 Thread Alexis Roda
En/na [EMAIL PROTECTED] ha escrit: > does anyone know a module or something to convert numbers like integer > to binary format ? http://www.google.es/search?q=python+integer+to+binary http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/219300 > for example I want to convert number 7 to 0111

Re: ConfigParser and multiple option names

2006-05-03 Thread Alexis Roda
Not tested by me, but according to docs it does support list values: http://cheeseshop.python.org/pypi/ConfigObj Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser and multiple option names

2006-05-02 Thread Alexis Roda
Florian Lindner escribió: > I think the best solution would be to use a seperation character: > > dir="/home/florian, /home/john, home/whoever" RCS uses , in filenames > What do you think? Any better ideas? A bit ugly, but probably safer and simpler than adding arbitrary separators: [section]

Re: critique this little script, if you like

2006-05-01 Thread Alexis Roda
John Salerno escribió: > Alexis Roda wrote: >> >> > The >> > try block seems nicer because it doesn't have such an ugly-looking >> check >> > to make. >> > > Why do you think that this try block is preferred over what I have (if I &

Re: critique this little script, if you like

2006-05-01 Thread Alexis Roda
John Salerno escribió: > 2. Between the if block or the try block, which is more Pythonic? Since the command line argument is optional I don't think it should be considered and exceptional condition if it's missing, so the "if" block looks better to me. No idea if this is more pythonic. > The

Re: lambda

2006-04-21 Thread Alexis Roda
Ben C escribió: > On 2006-04-21, Ben C <[EMAIL PROTECTED]> wrote: > Having said that, I attempted to confirm this using def rather than > lambda, and encountered something I cannot explain at all-- it appears > that the functions are getting redefined whenever they are called, to > effect a kind of

Re: lambda

2006-04-21 Thread Alexis Roda
[EMAIL PROTECTED] escribió: > Hello, > > # the idea is now to give the definition of the multiplication of > functions and integers > # (f * c)(xx) := f(x)*c > [lambda xx: f(xx)*y for y in range(1,5)][0](1) > # returns 4 here lambda uses a variable defined outside of the lambda (y). Any change m

Re: PyLint results?

2006-04-21 Thread Alexis Roda
Michael Yanowitz escribió: > Hello: > >I ran the new pylint and my code and I had a few questions on why those > are warnings or what I can do to fix them: > > 2) C: 0: Missing required attribute "__revision__" >What is this? Is that for CVS? I don't use CVS (we use SVN). I have not >

Re: Confused about properties, descriptors, and attributes...

2006-04-20 Thread Alexis Roda
[EMAIL PROTECTED] escribió: > I've been reading about Python Classes, and I'm a little confused about > how Python stores the state of an object. I was hoping for some help. > > I realize that you can't create an empty place holder for a member > variable of a Python object. It has to be given a v

Re: Unified web API for CGI and mod_python?

2006-04-16 Thread Alexis Roda
Tim Chase escribió: > > [EMAIL PROTECTED] cd ~tim/WebStack-1.1.2 > [EMAIL PROTECTED] python2.3 setup.py install > running install > error: invalid Python installation: unable to open > /usr/lib/python2.3/config/Makefile (No such file or directory) > apt-get install python2.3-dev HTH -- http

Re: Using default a empty dictionary as a default value

2005-03-22 Thread SER.RI-TIC-Alexis Roda
" HTH -- (@ @) oOO(_)OOo-- <> Ojo por ojo y el mundo acabara ciego /\ Alexis Roda - Universitat Rovira i Virgili - Reus,