Re: How to get the selected text of the webpage in chrome through python ?

2013-01-08 Thread Bruno Dupuis
nd dirty call to xclip -o, although there must be a pure python implementation which in turn depends on the python framework you play with (gtk/qt/wx/tk/...). Short answer is : it depends on your system, and it may be easier and more portable if you use a graphical toolkit. cheers. -- Brun

Re: Where to contribute Unicode General Category encoding/decoding

2012-12-13 Thread Bruno Dupuis
On Thu, Dec 13, 2012 at 01:51:00AM -0800, Pander Musubi wrote: > Hi all, > > I have created some handy code to encode and decode Unicode General > Categories. To which Python Package should I contribute this? > Hi, As said in a recent thread (a graph data structure IIRC), talking about new fea

Re: Confused compare function :)

2012-12-06 Thread Bruno Dupuis
On Thu, Dec 06, 2012 at 04:32:34AM +, Steven D'Aprano wrote: > On Thu, 06 Dec 2012 03:22:53 +, Rotwang wrote: > > > On 06/12/2012 00:19, Bruno Dupuis wrote: > >> [...] > >> > >> Another advice: never ever > >> > >> except XXXE

Re: Confused compare function :)

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 11:50:49PM +0100, Anatoli Hristov wrote: > I'm confused again with a compare update function. The problem is that > my function does not work at all and I don't get it where it comes > from. > > in my DB I have total of 754 products. when I run the function is says: > Total

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
I added a patch on the issue tracker. It solves the bug for short (<32700 bytes) functions ref : http://bugs.python.org/file28217/16619-1.patch -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 03:41:19PM -0500, Terry Reedy wrote: > On 12/5/2012 1:24 PM, Bruno Dupuis wrote: > >On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: > >>On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano > >> wrote: > >>>The difference

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
gt;>> def f(x): > ... return None > ... print(x) > ... > >>> f('test') > 42 This one is pretty scary The difference between `return None` and `return` leads to inconsistency and is in contradiction with the specs, AFAIK. I'm glad we pointed this out. -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list

Re: How does one make argparse print usage when no options are provided on the command line?

2012-12-05 Thread Bruno Dupuis
a separate usage statement. So they used argparse for everything but the > case where no command line args are given. > this is quite raw, but i'd add import sys if len(sys.argv) == 1: sys.argv.append('-h') before I call parser.parse_args() Should work -- Bruno Dup

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 05:40:51PM +0100, Bruno Dupuis wrote: > On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: > > Maybe it's the difference between LOAD_CONST and LOAD_GLOBAL. We > > can wonder why g uses the latter. > > Good point! I didn't even no

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: > On 2012-12-05, Bruno Dupuis wrote: > > Hi, > > > > I'm interested in compilers optimizations, so I study python > > compilation process > > > > I ran that script: > > > >

why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
mmhh... it comes to me now that the gap must be in function loading time... I'll check ceval.c However, isn't there a room for a slight optim here? (in this case, the dead code is obvious, but it may be hidden by complex loops and conditions) Cheers -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list