How do I say "two classes up in the inheritance chain" in python?

2009-01-26 Thread Daniel Fetchinson
I have two classes that both inherit from two other classes which both inherit from a single class. The two children have two almost identical methods: class grandparent( object ): def meth( self ): # do something class parent1( grandparent ): def meth( self ): # do someth

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin v. Löwis
> Well, the first step would be to tell Python that there is a code page > 65001. On Python 2.6, I get a LookupError for an unknown encoding after > doing "chcp 65001". I checked the list of aliases in Python 3 and there > was no entry for cp65001. I see. What happens if you add it to encoding/ali

Re: optparse with numpy.array?

2009-01-26 Thread Robert Kern
On 2009-01-27 00:01, Johan Ekh wrote: Thank you James, but I just can't optparse to accept an array, only integers, floats ans strings. My code looks like this from optparse import OptionParser parser = OptionParser() parser.add_option('-t', '--dt', action='store', type='float', dest='dt_i', de

Re: optparse with numpy.array?

2009-01-26 Thread James Mills
On Tue, Jan 27, 2009 at 4:01 PM, Johan Ekh wrote: > Thank you James, > but I just can't optparse to accept an array, only integers, floats ans > strings. > > My code looks like this > > from optparse import OptionParser > parser = OptionParser() > parser.add_option('-t', '--dt', action='store', ty

Re: optparse with numpy.array?

2009-01-26 Thread Johan Ekh
Thank you James, but I just can't optparse to accept an array, only integers, floats ans strings. My code looks like this from optparse import OptionParser parser = OptionParser() parser.add_option('-t', '--dt', action='store', type='float', dest='dt_i', default=0.1, help='time increment where ls

Re: optparse with numpy.array?

2009-01-26 Thread James Mills
On Tue, Jan 27, 2009 at 3:45 PM, Johan Ekh wrote: > Thank you Robert, > but what if I just want to create an array interactively, e.g. like m = > array([1.0, 2.0, 3.0]), and pass it > to my program? I tried extending optparse with a new type as explained in > the link you gave me > but I was not

Re: optparse with numpy.array?

2009-01-26 Thread Johan Ekh
Thank you Robert, but what if I just want to create an array interactively, e.g. like m = array([1.0, 2.0, 3.0]), and pass it to my program? I tried extending optparse with a new type as explained in the link you gave me but I was not able to get it to work. Is it really neccessary follow that rou

Re: ob_type in shared memory

2009-01-26 Thread Aaron Brady
On Jan 26, 9:20 pm, Aaron Brady wrote: > Hi, Mark, snip > On Jan 25, 9:47 pm, Mark Wooding wrote:> Aaron Brady > writes: > > > I am writing an extension using shared memory.  I need a data type > > > that is able to reassign its 'ob_type' field depending on what process > > > is calling it. >

Re: shutil module (directory input)

2009-01-26 Thread James Mills
On Tue, Jan 27, 2009 at 1:48 PM, klia wrote: > i am trying to tweak the current codes so that later when i call it from the > terminal i can provide sourcefile and the destination file rather being > fixed in the code.becuase now i have to specify the sourcefile and the > destinationfile in codes

Re: Method returning an Iterable Object

2009-01-26 Thread Terry Reedy
Anjanesh Lekshminarayanan wrote: But how come a raise StopIteration in the next() method doesnt need to be caught ? It works without breaking. The for-loop looks for and catches StopIteration. It is an essential part of what defines a finite iterator. (Note, in 3.0, next is renamed __next__ i

shutil module (directory input)

2009-01-26 Thread klia
hello folks i am trying to tweak the current codes so that later when i call it from the terminal i can provide sourcefile and the destination file rather being fixed in the code.becuase now i have to specify the sourcefile and the destinationfile in codes and not left to be specified from the te

Re: Method returning an Iterable Object

2009-01-26 Thread James Mills
On Tue, Jan 27, 2009 at 1:16 PM, Anjanesh Lekshminarayanan wrote: > But how come a raise StopIteration in the next() method doesnt need to > be caught ? It works without breaking. Because this exception is specially dealt with when iterating over an iterator. The "raise StopIteration" is what cau

Re: ob_type in shared memory

2009-01-26 Thread Aaron Brady
Hi, Mark, Do you mind if I approach you off the group about this? Aaron On Jan 25, 9:47 pm, Mark Wooding wrote: > Aaron Brady writes: > > I am writing an extension using shared memory.  I need a data type > > that is able to reassign its 'ob_type' field depending on what process > > is calling

Re: Method returning an Iterable Object

2009-01-26 Thread Anjanesh Lekshminarayanan
But how come a raise StopIteration in the next() method doesnt need to be caught ? It works without breaking. class twoTimes: max = 10**10 def __init__(self, n): self.__n = n def next(self): if self.__n > self.max: raise StopIteration self.__n *= 2

Re: print formating for matrix/table

2009-01-26 Thread Vincent Davis
I called it a matrix mostly because this is how I am visualizing it. They are full of numbers but only as representatives of students and schools. It looks like pprint will work after I read the instructions. At least I know where to look now. In the end I need to figure out how to save the data a

Re: optparse question

2009-01-26 Thread John Machin
On Jan 27, 12:02 pm, Pat wrote: > Up until today, I never needed to pass any arguments to a Python program. > > I did all the requisite reading and found that I should use optparse > instead of getopt.   I read the documentation and since the words > "simple" and "easy" often appeared in the examp

Pipe stdout && stderr to a TkLabel widget

2009-01-26 Thread rantingrick
I am wondering how i might pipe stdout && stderr to a Tkinter Label widget. here are a few ways to set the text #-- Create a label --# label = Label(master, text='Default Text') label.pack() # -- two ways to change the text --# label['text'] = 'New Text' label.configure(text='New Text') #-- or u

Re: optparse question

2009-01-26 Thread Matimus
> I did all the requisite reading and found that I should use optparse > instead of getopt.   I read the documentation and since the words > "simple" and "easy" often appeared in the examples and documentation, I > just knew that it would be a snap to implement. I don't know where you got that. 'g

Re: print formating for matrix/table

2009-01-26 Thread Robert Kern
On 2009-01-26 19:53, Vincent Davis wrote: I do have numpy but am using lists as did not need any functions of array. Well maybe print now. I am new to python and don't really know the details about the difference between lists and arrays. I do know that there are different/additional functions av

Re: print formating for matrix/table

2009-01-26 Thread Robert Kern
On 2009-01-26 19:55, Steve Holden wrote: Vincent Davis wrote: I have a list of listsa matrix in that all sub lists are the same length. I there a nice why to prin these so that the columns and rows line up nicely? I have looked around for a good way to do this and haven't found one I am like

Re: USB in python

2009-01-26 Thread Astan Chee
Brian Allen Vanderburg II wrote: This is the FT245 chip which is basically USB-to-Parallel. Chips: http://www.ftdichip.com/Products/FT245R.htm Kit/Board: http://www.ftdichip.com/Products/EvaluationKits/UM245R.htm The spec sheet for the board seems quite simple. It's pin out is similar to tha

Re: print formating for matrix/table

2009-01-26 Thread Steve Holden
Vincent Davis wrote: > I have a list of listsa matrix in that all sub lists are the > same length. I there a nice why to prin these so that the columns and > rows line up nicely? > I have looked around for a good way to do this and haven't found one I > am like. It seems that all involve repeat

Re: print formating for matrix/table

2009-01-26 Thread Vincent Davis
I do have numpy but am using lists as did not need any functions of array. Well maybe print now. I am new to python and don't really know the details about the difference between lists and arrays. I do know that there are different/additional functions available for arrays.Anyway is this the best s

Re: Dynamic methods and lambda functions

2009-01-26 Thread Steve Holden
Mark Wooding wrote: > Steve Holden writes: > >> Mark Wooding wrote: >>> * Assignment stores a new (reference to a) value in the variable. >>> >>> * Binding modifies the mapping between names and variables. >>> >> I realise I have omitted what was doubtless intended to be explanatory >> detail

Re: optparse question

2009-01-26 Thread Robert Kern
On 2009-01-26 19:02, Pat wrote: Up until today, I never needed to pass any arguments to a Python program. I did all the requisite reading and found that I should use optparse instead of getopt. I read the documentation and since the words "simple" and "easy" often appeared in the examples and do

Re: optparse question

2009-01-26 Thread James Mills
On Tue, Jan 27, 2009 at 11:02 AM, Pat wrote: (...) > What does it take to pass single parameter to a program? > http://docs.python.org/library/optparse.html stated that programs always > have options. Is that so? What about "dir /s"? Sample code: #!/us

optparse question

2009-01-26 Thread Pat
Up until today, I never needed to pass any arguments to a Python program. I did all the requisite reading and found that I should use optparse instead of getopt. I read the documentation and since the words "simple" and "easy" often appeared in the examples and documentation, I just knew tha

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Benjamin Kaplan
On Mon, Jan 26, 2009 at 5:42 PM, "Martin v. Löwis" wrote: > > I was hoping to find something that allows me to print any Unicode > > character on the console. > > You will have to debug the Python interpreter to find out what's > going wrong in code page 65001. Nobody has ever resolved that myster

Re: print formating for matrix/table

2009-01-26 Thread Robert Kern
On 2009-01-26 18:18, Vincent Davis wrote: I have a list of listsa matrix in that all sub lists are the same length. I there a nice why to prin these so that the columns and rows line up nicely? I have looked around for a good way to do this and haven't found one I am like. It seems that all i

print formating for matrix/table

2009-01-26 Thread Vincent Davis
I have a list of listsa matrix in that all sub lists are the same length. I there a nice why to prin these so that the columns and rows line up nicely? I have looked around for a good way to do this and haven't found one I am like. It seems that all involve repeating a print for each line. I wo

Re: Dynamic methods and lambda functions

2009-01-26 Thread Mark Wooding
Steve Holden writes: > Mark Wooding wrote: >> * Assignment stores a new (reference to a) value in the variable. >> >> * Binding modifies the mapping between names and variables. >> > I realise I have omitted what was doubtless intended to be explanatory > detail, but I am having trouble rec

Re: optparse with numpy.array?

2009-01-26 Thread Robert Kern
On 2009-01-26 17:44, Johan Ekh wrote: Hi all, I'm trying to use optparse to process command line parameters given to my program. It works as I expect for the types supported by optparse, i.e. int, float, string etc. but how can I pass a numpy.array or a list to my program? http://docs.python.or

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread John Machin
On Jan 27, 9:42 am, "Martin v. Löwis" wrote: > > I was hoping to find something that allows me to print any Unicode > > character on the console. > > You will have to debug the Python interpreter to find out what's > going wrong in code page 65001. Nobody has ever resolved that mystery, > although

CORRECTION: Re: Iterating through a file significantly slower when file has big buffer

2009-01-26 Thread python
Added the following lines missing from my original post: strategy1 = timer( 'Default buffer' ) strategy1.start() Code below is now complete. Malcolm SOURCE: import time # timer class class timer( object ): def __init__( self, message='' ): self.message = message def start( self )

optparse with numpy.array?

2009-01-26 Thread Johan Ekh
Hi all, I'm trying to use optparse to process command line parameters given to my program. It works as I expect for the types supported by optparse, i.e. int, float, string etc. but how can I pass a numpy.array or a list to my program? I have been searching for it but cannot find a good solution.

Iterating through a file significantly slower when file has big buffer

2009-01-26 Thread python
I'm working with very large text files and am always looking for ways to optimize the performance of our scripts. While reviewing our code, I wondered if changing the size of our file buffers to a very large buffer size might speed up our file I/O. Intuitively, I thought that bigger buffers might i

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread John Machin
On Jan 27, 10:00 am, "Martin v. Löwis" wrote: > > IOW, the bridge might think it's in cp1252 mode, but nobody told the > > engine room, which is still churning out cp850. > > I think you must use a different font in the console, too, such as > Lucida Sans Unicode. True. I was just about to post t

Re: USB in python

2009-01-26 Thread Дамјан Георгиевски
>> Sorry, by USB device, I meant a device that is powered/activated by a >> bunch of wires that I want to control using a computer and since I >> had a spare USB jack lying around, I used that instead. But so far I >> haven't tried it, nor will try it if it wont work properly. Yes, it >> is not a p

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin v. Löwis
> IOW, the bridge might think it's in cp1252 mode, but nobody told the > engine room, which is still churning out cp850. I think you must use a different font in the console, too, such as Lucida Sans Unicode. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin v. Löwis
> I was hoping to find something that allows me to print any Unicode > character on the console. You will have to debug the Python interpreter to find out what's going wrong in code page 65001. Nobody has ever resolved that mystery, although it's been known for some time. If you merely want to se

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread John Machin
On Jan 27, 8:38 am, Jean-Paul Calderone wrote: > On Mon, 26 Jan 2009 13:26:56 -0800 (PST), jefm > wrote: > >>As Benjamin Kaplin said, Windows terminals use the old cp1252 character > >>set, which cannot display the euro sign. You'll either have to run it in > >> something more modern like the cy

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Andreas Waldenburger
On 26 Jan 2009 22:12:43 GMT Marc 'BlackJack' Rintsch wrote: > On Mon, 26 Jan 2009 16:10:11 +0100, Andreas Waldenburger wrote: > > > On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch > > wrote: > > > >> On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote: > >> > >> > content = a.readl

scatterhist and resizing figures

2009-01-26 Thread perfreem
i am using scatterhist to plot some data. i find that when i plot the data and matlab shows it in the figure window, stretching the figure window (with the mouse) to enlarge it actually changes the properties of the figure. for example, making it bigger sometimes reveals more tick marks - like the

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Marc 'BlackJack' Rintsch
On Mon, 26 Jan 2009 16:10:11 +0100, Andreas Waldenburger wrote: > On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch > wrote: > >> On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote: >> >> > content = a.readlines() >> > >> > (Just because we can now write "for line in file" doesn't me

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
chcp 1252 does allow me to print the EURO sign. Thanks for pointing that out. However, it does not show me some ALL Unicode characters. Very frustrating. I was hoping to find something that allows me to print any Unicode character on the console. -- http://mail.python.org/mailman/listinfo/python-li

Re: Anoying unicode / str conversion problem

2009-01-26 Thread Hans Müller
Thanks Peter, your answer did the trick. I programed a lot with awk (also a very cool scripting language). So I was focused on the concept a dictionary key has to be string (as in awk). Since it's impossible to use a list as a dictionary key I thought it's also impossible to use a tuple as a key.

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
Now that I know the problem, I found the following on Google. Windows uses codepages to display different character sets. (http:// en.wikipedia.org/wiki/Code_page) The Windows chcp command allows you to change the character set from the original 437 set. When you type on the command line: chcp

Re: AttributeError: 'module' object has no attribute 'open_workbook'

2009-01-26 Thread John Machin
On Jan 27, 3:07 am, MRAB wrote: > Jay Jesus Amorin wrote: [snip] >  > Here's the error message: >  > >  > r...@nebuchadnezzar:/home/test/project# ./xlrd.py test.xls >  > Traceback (most recent call last): >  >   File "./xlrd.py", line 3, in >  >     import xlrd >  >   File "/home/jayam/project/xl

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Mon, 2009-01-26 at 12:37 -0800, Paul McGuire wrote: > On Jan 26, 2:06 pm, "J. Cliff Dyer" wrote: > > > > Thanks. That makes sense. But your example creates a new instance of > > the new class each time, rather than changing the class of a persistent > > instance, as the original example, to

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Jean-Paul Calderone
On Mon, 26 Jan 2009 13:26:56 -0800 (PST), jefm wrote: As Benjamin Kaplin said, Windows terminals use the old cp1252 character set, which cannot display the euro sign. You'll either have to run it in something more modern like the cygwin rxvt terminal, or output some other way, such as through a

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
>As Benjamin Kaplin said, Windows terminals use the old cp1252 character >set, which cannot display the euro sign. You'll either have to run it in > something more modern like the cygwin rxvt terminal, or output some >other way, such as through a GUI. >With the standard console, I get the same. B

Re: Anoying unicode / str conversion problem

2009-01-26 Thread Peter Otten
Hans Müller wrote: > Hi python experts, > > in the moment I'm struggling with an annoying problem in conjunction with > mysql. > > I'm fetching rows from a database, which the mysql drive returns as a list > of tuples. > > The default coding of the database is utf-8. > > Unfortunately in the d

Re: is None vs. == None

2009-01-26 Thread Steve Holden
Terry Reedy wrote: > Steve Holden wrote: >> Terry Reedy wrote: > >>> In 2.x, the *names* 'True' and 'False' can be rebound because bool is >>> new and people write >>> try: >>> False,True >>> except NameError: >>> False,True = 0,1 >>> >>> to make code back compatible. >>> >> I would claim that

Re: Pipe stdout && stderr to a TkLabel widget

2009-01-26 Thread rantingrick
OK, here is a simple example that will show you what i want to do. Right now if you type print 'hello' in the entry and press you will see braces in the label "{}". But if you type sys.stdou.write ("hello") you will see "{hello}" in the label. So i got the stdout piping to the widget now, but it w

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Terry Reedy
jefm wrote: Hi, while checking out Python 3, I read that all text strings are now natively Unicode. True In the Python language reference (http://docs.python.org/3.0/reference/ lexical_analysis.html) I read that I can show Unicode character in several ways. "\u" supposedly allows me to sp

Re: Monitor a FTP site for arrival of new/updated files

2009-01-26 Thread Giampaolo Rodola'
On 25 Gen, 21:11, Steve Holden wrote: > pyt...@bdurham.com wrote: > >  Any suggestions on a best practice way to monitor a remote FTP site for > > the arrival of new/updated files? I don't need specific code, just some > > coaching on technique based on your real-world experience including > > sug

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Michael Torrie
jefm wrote: >> Hmm this works for me, >> it's a self compiled version: >> ~ $ python3 >> Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) >> [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 > > You are running on Linux. Mine is on Windows. > Anyone else have this issue on Windows ? As Benjamin Kaplin

Re: Anoying unicode / str conversion problem

2009-01-26 Thread Benjamin Kaplan
On Mon, Jan 26, 2009 at 3:21 PM, Hans Müller wrote: > Hi python experts, > > in the moment I'm struggling with an annoying problem in conjunction with > mysql. > > I'm fetching rows from a database, which the mysql drive returns as a list > of tuples. > > The default coding of the database is utf

Re: I'm a python addict !

2009-01-26 Thread Paul McGuire
On Jan 26, 2:06 pm, "J. Cliff Dyer" wrote: > > Thanks.  That makes sense.  But your example creates a new instance of > the new class each time, rather than changing the class of a persistent > instance, as the original example, to which I was responding, did. > Look closer. The line that create

Re: is None vs. == None

2009-01-26 Thread Terry Reedy
Steve Holden wrote: Terry Reedy wrote: In 2.x, the *names* 'True' and 'False' can be rebound because bool is new and people write try: False,True except NameError: False,True = 0,1 to make code back compatible. I would claim that the ability to rebind True and False is a simple bug, tho

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Russ P.
On Jan 26, 1:07 am, Bruno Desthuilliers wrote: > No. I can change the *team's* code. Please *read*. "team's ownership", > ok ? Or do I have to spell it out loud ? TEAM'S OWNERSHIP. Uh. You get > the message, now ? Team ownership doesn't necessarily mean that you can just change code at will. In

Anoying unicode / str conversion problem

2009-01-26 Thread Hans Müller
Hi python experts, in the moment I'm struggling with an annoying problem in conjunction with mysql. I'm fetching rows from a database, which the mysql drive returns as a list of tuples. The default coding of the database is utf-8. Unfortunately in the database there are rows with different cod

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Mon, 2009-01-26 at 09:52 -0800, Paul McGuire wrote: > On Jan 26, 10:54 am, "J. Cliff Dyer" wrote: > > On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: > > > Want to change the type/behavior of an object from class A to class > > > B? How about this: > > > > > aobj = A() > > > ao

Re: I'm a python addict !

2009-01-26 Thread Scott David Daniels
J. Cliff Dyer wrote: On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: ... How about this: aobj = A() aobj.__class__ = B ... Wow. That looks very powerful and fun. But scary. Any thoughts on how you would use that in a way that wouldn't unleash sulphurous code smells? Seems li

Re: Method returning an Iterable Object

2009-01-26 Thread Andreas Waldenburger
On Tue, 27 Jan 2009 00:05:53 +0530 Anjanesh Lekshminarayanan wrote: > > You can also replace the whole class with a function thusly: > > > >def two_times(n): > >for k in itertools.count(1): > >yield n * (2**k) > > > > This function is then called a generator (because it ge

Re: A java hobbyist programmer learning python

2009-01-26 Thread Scott David Daniels
Tim Rowe wrote: ... I like the second style because it makes it leaves the 2-d implementation hidden, which is the whole point of encapsulation. I like the second as well, in that it it allows the parent to update any related data structures (for example, updating a display). However, I am a bi

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
>Hmm this works for me, >it's a self compiled version: >~ $ python3 >Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) >[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 You are running on Linux. Mine is on Windows. Anyone else have this issue on Windows ? -- http://mail.python.org/mailman/listinfo/pytho

Re: Plugin system, RuntimeWarning: Parent module 'ext_abc' not found while handling absolute import

2009-01-26 Thread Torsten Mohr
Hello, >> Basically, this here works but gives a warning: >> RuntimeWarning: Parent module 'ext_abc' not found while handling >> absolute import > > >> here = os.path.abspath('.') > > (Unrelated to the main question, but you probably want to use > os.path.dirname(os.path.abspath(__file__)) inst

Re: v = json.loads("{'test':'test'}")

2009-01-26 Thread Miles
On Mon, Jan 26, 2009 at 4:06 AM, Diez B. Roggisch wrote: > There are people who say something along the lines of "be strict when > writing, and tolerant when reading" (the exact quote is different, but > neither google:~site:mybrain nor any other have helped me here) That's Postel's Law: http://en

Python and CUDO

2009-01-26 Thread fredrik kant
Hi! Sorry about the misspelling, it should of course been "NIVIDAS CUDA". I also noticed that there wrappers around such as: pycuda which answers my question. -- Fredrik Kant Kant Consulting AB Mobile: +46 70 787 06 01 www.kantconsulting.se -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Benjamin Kaplan
On Mon, Jan 26, 2009 at 1:16 PM, jefm wrote: > Hi, > while checking out Python 3, I read that all text strings are now > natively Unicode. > In the Python language reference (http://docs.python.org/3.0/reference/ > lexical_analysis.html)

Re: Process crash with no reason

2009-01-26 Thread Philip Semanchuk
On Jan 26, 2009, at 1:13 PM, gil.shi...@gmail.com wrote: Hi All, I'm running a program that is acting as a nice interface to sybase' replication server. The program is using the cherrypy web service for the GUI. The process is crashing every few days with no reason. In the log I can see INFO a

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin
Hmm this works for me, it's a self compiled version: ~ $ python3 Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print("\u20ac") € >>> print ("\N{EURO SIGN}") € >>> 2009/1/26 j

Re: Method returning an Iterable Object

2009-01-26 Thread Anjanesh Lekshminarayanan
> You can also replace the whole class with a function thusly: > >def two_times(n): >for k in itertools.count(1): >yield n * (2**k) > > This function is then called a generator (because it generates an > iterator). You can now say > >infinitely_doubling_numbers = two_tim

unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
Hi, while checking out Python 3, I read that all text strings are now natively Unicode. In the Python language reference (http://docs.python.org/3.0/reference/ lexical_analysis.html) I read that I can show Unicode character in several ways. "\u" supposedly allows me to specify the Unicode chara

Re: Dynamic methods and lambda functions

2009-01-26 Thread Kay Schluehr
On 26 Jan., 15:13, Steve Holden wrote: > Mark Wooding wrote: > > unine...@gmail.com writes: > [...] > > * Assignment stores a new (reference to a) value in the variable. > > > * Binding modifies the mapping between names and variables. > > I realise I have omitted what was doubtless intended t

Process crash with no reason

2009-01-26 Thread gil . shinar
Hi All, I'm running a program that is acting as a nice interface to sybase' replication server. The program is using the cherrypy web service for the GUI. The process is crashing every few days with no reason. In the log I can see INFO and DEBUG (No ERROR) log lines and I do not get any TraceBack

Re: I'm a python addict !

2009-01-26 Thread Paul McGuire
On Jan 26, 10:54 am, "J. Cliff Dyer" wrote: > On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: > > Want to change the type/behavior of an object from class A to class > > B?  How about this: > > >     aobj = A() > >     aobj.__class__ = B > > > Try *that* in as simple-looking C++ or Java! >

Re: Web services

2009-01-26 Thread Chris Rebert
On Mon, Jan 26, 2009 at 8:11 AM, loial wrote: > I am trying to learn about web services and how to interface with a > 3rd party web service from python. > > Can anyone point me at an idiots guide/tutorial for someone who is new > to web services? The XML-RPC client module in the std lib (xmlrpcli

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Gabriel Genellina
En Mon, 26 Jan 2009 13:35:39 -0200, J. Cliff Dyer escribió: On Sun, 2009-01-25 at 18:23 -0800, John Machin wrote: On Jan 26, 1:03 pm, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase > escribió: > > I suppose if I were really smart, I'd dig a little deeper in the

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Gabriel Genellina
En Mon, 26 Jan 2009 13:35:39 -0200, J. Cliff Dyer escribió: On Sun, 2009-01-25 at 18:23 -0800, John Machin wrote: On Jan 26, 1:03 pm, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase > escribió: > > I suppose if I were really smart, I'd dig a little deeper in the

Re: Python C API (PyObject_CallMethod clear object)

2009-01-26 Thread Gabriel Genellina
En Mon, 26 Jan 2009 08:47:31 -0200, escribió: On 26 Jan., 03:25, "Gabriel Genellina" wrote: En Sun, 25 Jan 2009 23:46:01 -0200, escribió: > I have a problm with deallocating stuff. I call a function with this > command: > PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); >

Re: What is intvar? [Python Docs]

2009-01-26 Thread W. eWatson
r wrote: W. eWatson, I contacted the author of New Mexico Techs "Introduction to Tkinter" a couple of weeks ago. He is going to update the reference material with a few missing widgets and some info on Photo and Bitmap classes. I really love the NMT layout and use it quite often. Fredricks Tkint

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Bruno Desthuilliers
Russ P. a écrit : (snip) You are trying to dictate that the library implementer not be allowed to use enforced access restriction. And, in the larger sense, you are trying to dictate that access restrictions not be enforced in Python. FWIW, it's actually *you* who are trying to dictate that acc

Re: USB in python

2009-01-26 Thread Grant Edwards
On 2009-01-26, Lie Ryan wrote: > How about (a crazy idea) using the audio jack out? (DISCLAIMER: Little > Hardware Experience). High pitched sound (or anything in sound-ology that > means high voltage) means the device is on and low pitched sound off. 1) Pitch has nothing to do with voltage.

Re: Method returning an Iterable Object

2009-01-26 Thread Andreas Waldenburger
On Mon, 26 Jan 2009 22:01:21 +0530 Anjanesh Lekshminarayanan wrote: > Is there a way to return an iterable object ? > > class twoTimes: > def __init__(self, n): > self.__n = n > > def getNext(): > self.__n *= 2 > return self.__n > > Rename getNext() to next() a

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: > Want to change the type/behavior of an object from class A to class > B? How about this: > > aobj = A() > aobj.__class__ = B > > Try *that* in as simple-looking C++ or Java! Wow. That looks very powerful and fun. But scary. An

Re: Method returning an Iterable Object

2009-01-26 Thread Steve Holden
Anjanesh Lekshminarayanan wrote: > Is there a way to return an iterable object ? > > class twoTimes: > def __init__(self, n): > self.__n = n > > def getNext(): > self.__n *= 2 > return self.__n > > > t = twoTimes(5) > while (n in t.getNext()): # while (n in t): >

Method returning an Iterable Object

2009-01-26 Thread Anjanesh Lekshminarayanan
Is there a way to return an iterable object ? class twoTimes: def __init__(self, n): self.__n = n def getNext(): self.__n *= 2 return self.__n t = twoTimes(5) while (n in t.getNext()): # while (n in t): print (n) -- Anjanesh Lekshmnarayanan -- http://mail.p

Web services

2009-01-26 Thread loial
I am trying to learn about web services and how to interface with a 3rd party web service from python. Can anyone point me at an idiots guide/tutorial for someone who is new to web services? -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Mon, 2009-01-26 at 14:43 -0800, J Kenneth King wrote: > Linuxguy123 writes: > > > I just started using python last week and I'm addicted. > > > > I hate Perl. I never did learn to use it with any competence. I has to > > be the most obfuscated, cryptic language I've ever seen. Making it >

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Steve Holden
Paul Rubin wrote: > Steve Holden writes: >> Quite. Python is a language "for consenting adults". > > Shouldn't such a language allow consenting adults to enter a BDSM > scene without being moralized at, if that's what they want to do? ;-) Yes, but you know what moralizers are like ... regards

Problem with Nose testing until forking process

2009-01-26 Thread Jan Koprowski
Hi ! I write application witch sometimes need fork to shell based process (some kind of shell command). I snatch stdin, stdout, stderr and two additional streams and fork process to run command and get results. # -*- encoding: utf-8 -*- import os import sys import subprocess def pipes_functio

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Tim Rowe
2009/1/26 Paul Rubin <"http://phr.cx"@nospam.invalid>: > Steve Holden writes: >> Quite. Python is a language "for consenting adults". > > Shouldn't such a language allow consenting adults to enter a BDSM > scene without being moralized at, if that's what they want to do? ;-) The language doesn't

Re: AttributeError: 'module' object has no attribute 'open_workbook'

2009-01-26 Thread MRAB
Jay Jesus Amorin wrote: > Hi, > > Kindly help, I've got this error when running my script: > > AttributeError: 'module' object has no attribute 'open_workbook' > > > Here's my code: > > #!/usr/bin/python > > import xlrd > import sys > > mySpreadsheet = xlrd.open_workbook(open(sys.argv[1])) > first

Re: really slow gzip decompress, why?

2009-01-26 Thread Jeff McNeil
On Jan 26, 10:51 am, Jeff McNeil wrote: > On Jan 26, 10:22 am, redbaron wrote: > > > I've one big (6.9 Gb) .gz file with text inside it. > > zcat bigfile.gz > /dev/null does the job in 4 minutes 50 seconds > > > python code have been doing the same job for 25 minutes and still > > doesn't finish

Re: really slow gzip decompress, why?

2009-01-26 Thread Jeff McNeil
On Jan 26, 10:22 am, redbaron wrote: > I've one big (6.9 Gb) .gz file with text inside it. > zcat bigfile.gz > /dev/null does the job in 4 minutes 50 seconds > > python code have been doing the same job for 25 minutes and still > doesn't finish =( the code is simpliest I could ever imagine: > > de

AttributeError: 'module' object has no attribute 'open_workbook'

2009-01-26 Thread Jay Jesus Amorin
Hi, Kindly help, I've got this error when running my script: AttributeError: 'module' object has no attribute 'open_workbook' Here's my code: #!/usr/bin/python import xlrd import sys mySpreadsheet = xlrd.open_workbook(open(sys.argv[1])) firstSheet = wb.sheet_by_index(0) for myRows in range(

Re: really slow gzip decompress, why?

2009-01-26 Thread Diez B. Roggisch
redbaron wrote: > I've one big (6.9 Gb) .gz file with text inside it. > zcat bigfile.gz > /dev/null does the job in 4 minutes 50 seconds > > python code have been doing the same job for 25 minutes and still > doesn't finish =( the code is simpliest I could ever imagine: > > def main(): > fh =

Re: strange error whilst porting to 2.6

2009-01-26 Thread Robin Becker
Robin Becker wrote: I found that this error Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in ignored occurs when attempting to copy (copy.copy(inst)) an instance of a class that looks like this class LazyParagraph(_LazyMixin,TTParagraph): SUPER=TTPar

  1   2   >