Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread alex23
On Jan 24, 4:56 am, 8 Dihedral wrote: > 在 2012年1月23日星期一UTC+8上午2时01分11秒,Robert Kern写道: > >    [line.strip('\n') for line in f] > > This is more powerful by turning an object to be iterable. > But the list comprehension violates the basic operating > principle of the iteratee chaining rule in pr

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Chris Angelico
On Tue, Jan 24, 2012 at 5:53 PM, Ian Kelly wrote: > On Mon, Jan 23, 2012 at 10:57 PM, Rick Johnson > wrote: >> >> Here is a grep > > A grep?  What is a grep? According to the damage type table on Aardwolf MUD, a grep is a type of slash - at least, it's resisted by the same armor value that resis

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread alex23
On Jan 24, 4:05 pm, Evan Driscoll wrote: > On 1/23/2012 23:57, Rick Johnson wrote:> Of > > course, "used to" and "supposed to" will require people to rethink > > there lazy and slothful ways. > > I'll go repent in the corner, over their. You forget, Rick's errors are genuine mistakes that only a

Re: problems with tkinter updates

2012-01-23 Thread yves
On 2012-01-23 20:57, Dave Angel wrote: You have it backward. The question is not what you do inside your loop to give tk a chance, but rather what do you do to make tk give you a chance. tk doesn't "start" till you make the mainloop() method call, and once you call that method, it won't return

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Ian Kelly
On Mon, Jan 23, 2012 at 10:57 PM, Rick Johnson wrote: > > Here is a grep A grep? What is a grep? That word is not in any of my dictionaries. Are you perhaps carelessly invoking the neologism of referring to an execution of the "grep" UNIX program as "a grep"? > from the month of September 2011

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Andrew Berg
You're right, but it's pretty hard for some people to do what they're supposed to when it isn't what they're used to. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Chris Angelico
On Tue, Jan 24, 2012 at 4:57 PM, Rick Johnson wrote: > > Here is a grep from the month of September 2011... Is it? Interesting. I met that month yesterday (she was shopping in Oakleigh, don't ask) and she knew nothing about it. Oh, did you mean "Here is the result of using the grep(1) utility on

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Rodrick Brown
On Tue, Jan 24, 2012 at 1:06 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 23 Jan 2012 21:57:16 -0800, Rick Johnson wrote: > > > Here is a grep from the month of September 2011 showing the rampantly > > egregious misuse of the following words and phrases: > > > > * p

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Steven D'Aprano
On Mon, 23 Jan 2012 21:57:16 -0800, Rick Johnson wrote: > Here is a grep from the month of September 2011 showing the rampantly > egregious misuse of the following words and phrases: > > * pretty > * hard > * right > * used to > * supposed to I'm pretty sure that this news group is supposed to be

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Evan Driscoll
On 1/23/2012 23:57, Rick Johnson wrote: > Of > course, "used to" and "supposed to" will require people to rethink > there lazy and slothful ways. I'll go repent in the corner, over their. signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Rick Johnson
Here is a grep from the month of September 2011 showing the rampantly egregious misuse of the following words and phrases: * pretty * hard * right * used to * supposed to "Pretty" is the most ludicrous of them all! As you will see, "pretty" is used superfluously, over and over again! In fac

Re: Parsing a serial stream too slowly

2012-01-23 Thread Steven D'Aprano
On Tue, 24 Jan 2012 10:49:41 +1100, Cameron Simpson wrote: > | def OnSerialRead(self, event): > | text = event.data > | self.sensorabuffer = self.sensorabuffer + text > | self.sensorbbuffer = self.sensorbbuffer + text > | self.sensorcbuffer = self.sensorcbuffer + text > > Slow a

Re: String interning in Python 3 - missing or moved?

2012-01-23 Thread Chris Angelico
On Tue, Jan 24, 2012 at 3:18 PM, Terry Reedy wrote: > I think that the devs decided that interning is a minor internal > optimization that users generally should not fiddle with (especially how > that so much is done automatically anyway*), while having it a builtin made > it look like something t

Re: String interning in Python 3 - missing or moved?

2012-01-23 Thread Terry Reedy
On 1/23/2012 9:25 PM, Chris Rebert wrote: On Mon, Jan 23, 2012 at 4:38 PM, Chris Angelico wrote: Python 2 can intern 'str' (bytes) strings (with the eponymous builtin, and with C API functions), though not unicode. Python 3 does not have that builtin, nor the C API; I can't find any support for

Re: problems with tkinter updates

2012-01-23 Thread Dave Angel
On 01/23/2012 08:09 PM, y...@zioup.com wrote: I'm missing something about tkinter updates. How can I give tkinter a chance to run? Here's some code: import time import tkinter import tkinter.scrolledtext tk = tkinter.Tk() f = tkinter.Toplevel(tk) st = tkinter.scrolledtext.ScrolledText(f) st

Re: while True or while 1

2012-01-23 Thread Steven D'Aprano
On Mon, 23 Jan 2012 20:50:11 +, Andrea Crotti wrote: > while 1 works because the 1 is converted to boolean automatically, but > why not just writing a boolean > in the first place? You have misunderstood Python's truth model. It is similar to languages like Javascript and PHP, where EVERY ob

Re: String interning in Python 3 - missing or moved?

2012-01-23 Thread Chris Angelico
On Tue, Jan 24, 2012 at 1:25 PM, Chris Rebert wrote: > The former, into `sys`: > http://docs.python.org/dev/library/sys.html#sys.intern > Search the "What's New"s in the future. > http://docs.python.org/release/3.1.3/whatsnew/3.0.html#builtins Doh, should have checked. Thanks! ChrisA -- http://

Re: Parsing a serial stream too slowly

2012-01-23 Thread M.Pekala
On Jan 23, 6:49 pm, Cameron Simpson wrote: > On 23Jan2012 13:48, M.Pekala wrote: > | Hello, I am having some trouble with a serial stream on a project I am > | working on. I have an external board that is attached to a set of > | sensors. The board polls the sensors, filters them, formats the > |

Re: String interning in Python 3 - missing or moved?

2012-01-23 Thread Chris Rebert
On Mon, Jan 23, 2012 at 4:38 PM, Chris Angelico wrote: > Python 2 can intern 'str' (bytes) strings (with the eponymous builtin, > and with C API functions), though not unicode. Python 3 does not have > that builtin, nor the C API; I can't find any support for either str > or bytes. > > Has it been

GOZERBOT 1.0.1 FINAL

2012-01-23 Thread Bart Thate
GOZERBOT 1.0.1 FINAL released ;] last bugs kinked out (i hope) and lots of docs updates (see http://gozerbot.org) downloadable at http://gozerbot.googlecode.com or use "easy_install gozerbot" or run "hg clone http://gozerbot.googlecode.com/hg mybot" Below a cool animation of the GOZERBOT code re

problems with tkinter updates

2012-01-23 Thread yves
I'm missing something about tkinter updates. How can I give tkinter a chance to run? Here's some code: import time import tkinter import tkinter.scrolledtext tk = tkinter.Tk() f = tkinter.Toplevel(tk) st = tkinter.scrolledtext.ScrolledText(f) st.pack() def update(): print('updating')

String interning in Python 3 - missing or moved?

2012-01-23 Thread Chris Angelico
Python 2 can intern 'str' (bytes) strings (with the eponymous builtin, and with C API functions), though not unicode. Python 3 does not have that builtin, nor the C API; I can't find any support for either str or bytes. Has it been moved, or is interning as a concept deprecated? I don't have a us

python.org mailman web interface problem

2012-01-23 Thread Chris Rebert
Accessing http://mail.python.org/mailman/listinfo/ currently gives: """ Bug in Mailman version 2.1.12 We're sorry, we hit a bug! Please inform the webmaster for this site of this problem. Printing of traceback and other system information has been explicitly inhibited, but the webmaster can find

Re: Parsing a serial stream too slowly

2012-01-23 Thread Cameron Simpson
On 23Jan2012 13:48, M.Pekala wrote: | Hello, I am having some trouble with a serial stream on a project I am | working on. I have an external board that is attached to a set of | sensors. The board polls the sensors, filters them, formats the | values, and sends the formatted values over a serial

Re: Parsing a serial stream too slowly

2012-01-23 Thread Nick Dokos
M.Pekala wrote: > On Jan 23, 5:00 pm, Jon Clements wrote: > > On Jan 23, 9:48 pm, "M.Pekala" wrote: > > > > > > > > > > > > > > > > > > > > > Hello, I am having some trouble with a serial stream on a project I am > > > working on. I have an external board that is attached to a set of > > > sens

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 4:57 PM, Ian Kelly wrote: > > By the way, looking at your object hierarchy more closely, isn't > "app.frame.graph_panel" going to end up being the same thing as just > "self.figure"? Why not just use the latter and remove the reliance on > finding the correct frame? > I

Generating a .pc file using distutils

2012-01-23 Thread Tycho Andersen
Is there some standard way to generate a .pc file (given a .pc.in or similar) using distutils? If there's not, is there a good way to access whatever the user passes in as --prefix (besides parsing sys.argv yourself)? Thanks, \t -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing a serial stream too slowly

2012-01-23 Thread Thomas Rachel
Am 23.01.2012 22:48 schrieb M.Pekala: Hello, I am having some trouble with a serial stream on a project I am working on. I have an external board that is attached to a set of sensors. The board polls the sensors, filters them, formats the values, and sends the formatted values over a serial bus.

Re: Using an object inside a class

2012-01-23 Thread Ian Kelly
On Mon, Jan 23, 2012 at 3:45 PM, Jonno wrote: > I see, so that would get me access to the app instance during init of Class1 > but if I can't access frame or the object as they still aren't created yet. > I can only do that in attributes that I know won't be called until the app > is created. Yea

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 4:20 PM, Ian Kelly wrote: > > The App object is created and the wx framework already knows about it. > It's just not assigned to the app global yet, and the OnInit call has > not completed yet. See: > > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit > (I

Re: while True or while 1

2012-01-23 Thread 88888 Dihedral
在 2012年1月24日星期二UTC+8上午4时50分11秒,Andrea Crotti写道: > On 01/23/2012 06:05 PM, Evan Driscoll wrote: > > > > To play devil's advocate for a moment, if you have the choice between > > two ways of writing something, A and B, where both are basically the > > same in terms of difficulty to write, difficult

Re: Using an object inside a class

2012-01-23 Thread Ian Kelly
On Mon, Jan 23, 2012 at 2:52 PM, Jonno wrote: > On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly wrote: >> >> Exactly.  The line "app = MyApp(0)" creates a MyApp instance and then >> assigns it to "app".  As part of the MyApp creation process, it >> creates a MyFrame, which creates a Tab, which creates

Re: Parsing a serial stream too slowly

2012-01-23 Thread M.Pekala
On Jan 23, 5:00 pm, Jon Clements wrote: > On Jan 23, 9:48 pm, "M.Pekala" wrote: > > > > > > > > > > > Hello, I am having some trouble with a serial stream on a project I am > > working on. I have an external board that is attached to a set of > > sensors. The board polls the sensors, filters them

Re: Parsing a serial stream too slowly

2012-01-23 Thread Jon Clements
On Jan 23, 9:48 pm, "M.Pekala" wrote: > Hello, I am having some trouble with a serial stream on a project I am > working on. I have an external board that is attached to a set of > sensors. The board polls the sensors, filters them, formats the > values, and sends the formatted values over a seria

Re: Parsing a serial stream too slowly

2012-01-23 Thread Jerry Hill
On Mon, Jan 23, 2012 at 4:48 PM, M.Pekala wrote: > Hello, I am having some trouble with a serial stream on a project I am > When one sensor is running my python script grabs the data just fine, > removes the formatting, and throws it into a text control box. However > when 3 or more sensors are r

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly wrote: > > Exactly. The line "app = MyApp(0)" creates a MyApp instance and then > assigns it to "app". As part of the MyApp creation process, it > creates a MyFrame, which creates a Tab, which creates a Class1, which > attempts to reference "app". All

Parsing a serial stream too slowly

2012-01-23 Thread M.Pekala
Hello, I am having some trouble with a serial stream on a project I am working on. I have an external board that is attached to a set of sensors. The board polls the sensors, filters them, formats the values, and sends the formatted values over a serial bus. The serial stream comes out like $A1234$

Re: Using an object inside a class

2012-01-23 Thread Ian Kelly
On Mon, Jan 23, 2012 at 2:22 PM, Jonno wrote: >> References inside functions are resolved when the function is called. So >> purely from what you have presented above, it would seem that 'foo' is >> defined between the call to __init__ and a later call to method1. > > > I have a strong suspicion t

Re: Using an object inside a class

2012-01-23 Thread Benjamin Kaplan
On Mon, Jan 23, 2012 at 4:22 PM, Jonno wrote: > > > On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy wrote: >> >> On 1/23/2012 2:44 PM, Jonno wrote: >>> >>> I have a pretty complicated bit of code that I'm trying to convert to >>> more clean OOP. >>> >>> Without getting too heavy into the details I h

Re: Using an object inside a class

2012-01-23 Thread Jonno
Script... import wx import wx.aui import matplotlib as mpl from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas class Class1(wx.Panel): def __init__(self, parent, id = -1, dpi = None, **kwargs): wx.Panel.__init__(self, parent, id=id, **kwargs) self.figure

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy wrote: > On 1/23/2012 2:44 PM, Jonno wrote: > >> I have a pretty complicated bit of code that I'm trying to convert to >> more clean OOP. >> >> Without getting too heavy into the details I have an object which I am >> trying to make available inside an

Re: Using an object inside a class

2012-01-23 Thread Ian Kelly
On Mon, Jan 23, 2012 at 1:58 PM, MRAB wrote: >> Either way would work but the main issue is I can't seem to use foo or >> foo.bar or foo.bar.object anywhere in __init__ or even before that in >> the main class area. >> > This line: > > foo = MyApp(0) > > will create a 'MyApp' instance and then bin

Re: Using an object inside a class

2012-01-23 Thread MRAB
On 23/01/2012 20:27, Jonno wrote: On Mon, Jan 23, 2012 at 2:09 PM, Ian Kelly mailto:ian.g.ke...@gmail.com>> wrote: On Mon, Jan 23, 2012 at 12:44 PM, Jonno mailto:jonnojohn...@gmail.com>> wrote: > I have a pretty complicated bit of code that I'm trying to convert to more > cle

Re: while True or while 1

2012-01-23 Thread Andrea Crotti
On 01/23/2012 06:05 PM, Evan Driscoll wrote: To play devil's advocate for a moment, if you have the choice between two ways of writing something, A and B, where both are basically the same in terms of difficulty to write, difficulty to maintain, and difficulty to understand, but A is faster t

Re: Using an object inside a class

2012-01-23 Thread Ethan Furman
Gary Herron wrote: If the method does not bind it, then Python will look in the class for foo. This could work class Class1: foo = whatever # Available to all instances def __init__(self): foo.bar.object self.foo.bar.object ^- needs the self r

Re: Using an object inside a class

2012-01-23 Thread Gary Herron
On 01/23/2012 11:44 AM, Jonno wrote: I have a pretty complicated bit of code that I'm trying to convert to more clean OOP. Without getting too heavy into the details I have an object which I am trying to make available inside another class. The reference to the object is rather long and convo

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 2:09 PM, Ian Kelly wrote: > On Mon, Jan 23, 2012 at 12:44 PM, Jonno wrote: > > I have a pretty complicated bit of code that I'm trying to convert to > more > > clean OOP. > > Then you probably should not be using globals. > I'm trying to rewrite the whole thing to get ri

Re: Using an object inside a class

2012-01-23 Thread Terry Reedy
On 1/23/2012 2:44 PM, Jonno wrote: I have a pretty complicated bit of code that I'm trying to convert to more clean OOP. Without getting too heavy into the details I have an object which I am trying to make available inside another class. The reference to the object is rather long and convoluted

Re: while True or while 1

2012-01-23 Thread Giampaolo Rodolà
Il 23 gennaio 2012 20:12, Erik Max Francis ha scritto: > Giampaolo Rodolà wrote: >> >> Il 21 gennaio 2012 22:13, Erik Max Francis ha scritto: >>> >>> The real reason people still use the `while 1` construct, I would >>> imagine, >>> >>> is just inertia or habit, rather than a conscious, defensive

Re: Using an object inside a class

2012-01-23 Thread Michael Torrie
On 01/23/2012 12:44 PM, Jonno wrote: > Any ideas why I can reference foo inside the method but not in __init__? No idea, but could you pass foo as a constructor parameter to __init__ and store it as an instance variable? -- http://mail.python.org/mailman/listinfo/python-list

Re: Using an object inside a class

2012-01-23 Thread Ian Kelly
On Mon, Jan 23, 2012 at 12:44 PM, Jonno wrote: > I have a pretty complicated bit of code that I'm trying to convert to more > clean OOP. Then you probably should not be using globals. > Without getting too heavy into the details I have an object which I am > trying to make available inside anoth

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 1:44 PM, Jonno wrote: > I have a pretty complicated bit of code that I'm trying to convert to more > clean OOP. > > Without getting too heavy into the details I have an object which I am > trying to make available inside another class. The reference to the object > is rath

Determining version of OpenSSL linked against python?

2012-01-23 Thread Adam Mercer
Hi I'm trying to write a script that determines the version of OpenSSL that python is linked against, using python-2.7 this is easy as I can use: import ssl ssl.OPENSSL_VERSION but unfortunately I need to support python-2.6, from an older script I used the following: import _ssl

Using an object inside a class

2012-01-23 Thread Jonno
I have a pretty complicated bit of code that I'm trying to convert to more clean OOP. Without getting too heavy into the details I have an object which I am trying to make available inside another class. The reference to the object is rather long and convoluted but what I find is that within my cl

Re: while True or while 1

2012-01-23 Thread Erik Max Francis
Giampaolo Rodolà wrote: Il 21 gennaio 2012 22:13, Erik Max Francis ha scritto: The real reason people still use the `while 1` construct, I would imagine, is just inertia or habit, rather than a conscious, defensive decision. If it's the latter, it's a case of being _way_ too defensive. It's

Re: while True or while 1

2012-01-23 Thread Evan Driscoll
On 01/23/2012 11:39 AM, Ian Kelly wrote: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil" -- Donald Knuth To play devil's advocate for a moment, if you have the choice between two ways of writing something, A and B, where bo

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread 88888 Dihedral
在 2012年1月23日星期一UTC+8上午2时01分11秒,Robert Kern写道: > On 1/22/12 3:50 PM, Rick Johnson wrote: > > > > What does Python do when presented with this code? > > > > py> [line.strip('\n') for line in f.readlines()] > > > > If Python reads all the file lines first and THEN iterates AGAIN to do > > the strip;

CompIMAGE 2012 - Call for Papers

2012-01-23 Thread tava...@fe.up.pt
Dear Colleague, We would like to call your attention to the International Symposium CompIMAGE 2012 - Computational Modeling of Objects Presented in Images: Fundamentals, Methods and Applications (www.dis.uniroma1.it/ compimage2012), that will be held in Rome, ITALY, in September 5-7, 2012. MAIN

Re: while True or while 1

2012-01-23 Thread Dave Angel
On 01/23/2012 08:28 AM, Hrvoje Niksic wrote: Dave Angel writes: I do something similar when there's a portion of code that should never be reached: assert("reason why I cannot get here") Shouldn't that be assert False, "reason why I cannot get here"? You caught me in a typo. If it's in pyth

Re: PyHook to catch mouse events

2012-01-23 Thread Dave Angel
On 01/23/2012 08:35 AM, Neru Yume wrote: Date: Mon, 23 Jan 2012 08:24:41 -0500 From: d...@davea.name To: neruy...@hotmail.com CC: python-list@python.org Subject: Re: PyHook to catch mouse events On 01/23/2012 07:06 AM, Neru Yume wrote: Using PyHook to record mouse events, one has to add quite

What happened tp scipy.stsci?

2012-01-23 Thread Wanderer
Back in scipy 0.7 there was a package called stsci that had function scipy.stsci.image.median that created a median image from a stack of images. The stsci package is dropped in v0.8. Has this functionality been moved to a different package? Thanks Apologies if this is a double post. I had probl

Re: while True or while 1

2012-01-23 Thread Ian Kelly
On Mon, Jan 23, 2012 at 9:41 AM, Giampaolo Rodolà wrote: > > Il 21 gennaio 2012 22:13, Erik Max Francis ha scritto: > > The real reason people still use the `while 1` construct, I would imagine, > > is just inertia or habit, rather than a conscious, defensive decision.  If > > it's the latter, it

Re: while True or while 1

2012-01-23 Thread Giampaolo Rodolà
Il 21 gennaio 2012 22:13, Erik Max Francis ha scritto: > The real reason people still use the `while 1` construct, I would imagine, > is just inertia or habit, rather than a conscious, defensive decision.  If > it's the latter, it's a case of being _way_ too defensive. It's also because while 1 i

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread Grant Edwards
On 2012-01-22, Rick Johnson wrote: > What does Python do when presented with this code? It does what you tell it to. What else would you expect? -- Grant Edwards grant.b.edwardsYow! Are we wet yet? at

Re: access address from object and vice versa

2012-01-23 Thread Grant Edwards
On 2012-01-22, Steven D'Aprano wrote: > On Sat, 21 Jan 2012 19:36:32 -0800, Chris Rebert wrote: > >> On Sat, Jan 21, 2012 at 7:04 PM, Tamer Higazi >> wrote: >>> Hi people! >>> I have asked myself the following thing. >>> >>> How do I access the address of an object >> >> id(obj) happens to do th

Re: while True or while 1

2012-01-23 Thread Grant Edwards
On 2012-01-21, Erik Max Francis wrote: > Chris Angelico wrote: >> On Sun, Jan 22, 2012 at 12:47 AM, Andrea Crotti >> wrote: >>> So I tried to do the following, and the result is surprising. For what >>> I can see it looks like the interpreter can optimize away the 1 boolean >>> conversion while

Re: lxml to parse html

2012-01-23 Thread Adam Tauno Williams
On Mon, 2012-01-23 at 15:39 +0800, contro opinion wrote: > import lxml.html > myxml=''' > > > Use lxml.etree not lxml.html. Your content is XML, not HTML. -- System & Network Administrator [ LPI & NCLA ] OpenGroupware Developer

Re: can some one help me with my code. thanks

2012-01-23 Thread Tamanna Sultana
On Jan 20, 9:23 pm, Steven D'Aprano wrote: > On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: > > On Jan 20, 12:49 pm, Tamanna Sultana wrote: > >> > If you can give me some lead to fix the code I wrote below that will > >> > be great: > > > Your variable names need a bit more thought > > >

Re: can some one help me with my code. thanks

2012-01-23 Thread Tamanna Sultana
On Jan 20, 11:03 pm, Chris Angelico wrote: > On Sat, Jan 21, 2012 at 1:23 PM, Steven D'Aprano > > wrote: > > On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: > >> Your variable names need a bit more thought > > >>> def average(bin): > > >> What is a "bin"? Maybe you shoulc have called this

RE: PyHook to catch mouse events

2012-01-23 Thread Neru Yume
> Date: Mon, 23 Jan 2012 08:24:41 -0500 > From: d...@davea.name > To: neruy...@hotmail.com > CC: python-list@python.org > Subject: Re: PyHook to catch mouse events > > On 01/23/2012 07:06 AM, Neru Yume wrote: > > Using PyHook to record mouse events, one has to add quite a few lines to > > set up

Re: while True or while 1

2012-01-23 Thread Hrvoje Niksic
Dave Angel writes: > I do something similar when there's a portion of code that should > never be reached: > > assert("reason why I cannot get here") Shouldn't that be assert False, "reason why I cannot get here"? -- http://mail.python.org/mailman/listinfo/python-list

Re: PyHook to catch mouse events

2012-01-23 Thread Dave Angel
On 01/23/2012 07:06 AM, Neru Yume wrote: Using PyHook to record mouse events, one has to add quite a few lines to set up a hook, and as far as I have experienced, if one uses time.sleep() or some other function that spends some time doing something, the program freezes my computer completely w

Re: while True or while 1

2012-01-23 Thread Dave Angel
On 01/22/2012 10:55 PM, alex23 wrote: On Jan 23, 2:05 am, Dan Sommers wrote: As per a now-ancient suggestion on this mailing list (I believe it was by Tim Peters), I've also been known to use a non-empty, literal Python string as a self-documenting, forever-True value in the typical loop-and-a-

Re: Installing Python on CentOS 6 - a big pain

2012-01-23 Thread Benedict Verheyen
On 20/01/2012 12:42, Anssi Saari wrote: > Benedict Verheyen writes: > >> If i need to install a new version of Python, as I happen to have done today, >> I only need to do step 4. Which is maybe 5 minutes of work. > > I don't really understand why you compile these common libraries (zlib, > ncur

PyHook to catch mouse events

2012-01-23 Thread Neru Yume
Using PyHook to record mouse events, one has to add quite a few lines to set up a hook, and as far as I have experienced, if one uses time.sleep() or some other function that spends some time doing something, the program freezes my computer completely while doing this (the cursor starts moving

A way to write properties

2012-01-23 Thread Arnaud Delobelle
Hi all, It just occurred to me that there's a very simple but slightly different way to implement properties: class PropertyType(type): def __get__(self, obj, objtype): return self if obj is None else self.get(obj) def __set__(self, obj, val): self.set(obj, val) def __

Re: access address from object and vice versa

2012-01-23 Thread Duncan Booth
Steven D'Aprano wrote: > On the other hand, presumably this means that Jython objects need an > extra field to store the ID, so the CPython approach is a space > optimization. > Given that using `id()` is such an uncommon occurence I would expect the ids to be stored outside the object in som

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-23 Thread Steven D'Aprano
On Sun, 22 Jan 2012 07:50:59 -0800, Rick Johnson wrote: > What does Python do when presented with this code? > > py> [line.strip('\n') for line in f.readlines()] > > If Python reads all the file lines first and THEN iterates AGAIN to do > the strip; we are driving a Fred flintstone mobile. Nons

Re: lxml to parse html

2012-01-23 Thread Stefan Behnel
contro opinion, 23.01.2012 08:34: > import lxml.html > myxml=''' > > > > > table="tpa_radio_sum"> > > > > > > > ''' > root=lxml.html.fromstring(myxml) > nodes1=root.xpath('//job[@DecreaseHour="1"]') > nodes2=

Re: lxml to parse html

2012-01-23 Thread Peter Otten
contro opinion wrote: > import lxml.html > myxml=''' > > > > > > > > > > > > ''' > root=lxml.html.fromstring(myxml) > nodes1=root.xpath('//job[@DecreaseHour="1"]') > nodes2=root.xpath('//job[@table="tpa_radio_sum"]') > print "nodes1=",nodes1 > print "nodes2=",nodes2 > > > nodes1=

Re: __future__ and __rdiv__

2012-01-23 Thread Duncan Booth
Terry Reedy wrote: > But if you mean for Number to be like a float > rather than int, do as you are (with / and __truediv__). > Or even __rtruediv__ -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble with internationalized path under windows

2012-01-23 Thread Chris Angelico
On Mon, Jan 23, 2012 at 12:49 PM, Rick Johnson wrote: > The fact is, Unicode is nothing more than a monkey patch for language > multiplicity. A multiplicity that is perpetuated on the masses due to > a blind adherence to the cult of xenophobia. I agree. We need to abolish all languages but one, a

Re: __future__ and __rdiv__

2012-01-23 Thread Terry Reedy
On 1/23/2012 12:22 AM, Massimo Di Pierro wrote: Hello everybody, I hope somebody could help me with this problem. If this is not the right place to ask, please direct me to the right place and apologies. I am using Python 2.7 and I am writing some code I want to work on 3.x as well. The proble