Re: Class or Dictionary?

2011-02-12 Thread Terry Reedy
On 2/12/2011 9:20 PM, Martin De Kauwe wrote: On Feb 13, 5:12 am, Terry Reedy wrote: On 2/12/2011 1:24 AM, Martin De Kauwe wrote: The point of this posting was just to ask those that know, whether it was a bad idea to use the class object in the way I had or was that OK? And if I should have j

Re: [ANN]: sahriswiki 0.8.1 (a Lightweight Wiki Engine)

2011-02-12 Thread Chris Rebert
FYI: Your macro listing page seems to be broken: http://sahriswiki.org/Macros Cheers, Chris On Sat, Feb 12, 2011 at 2:13 PM, James Mills wrote: > Hello all, > > I'm pleased to announce the release of sahriswiki 0.8.1 > > This is a minor bug-fix release. > > For more information see the PyPi page

Re: Question on Creating exe file with py2exe

2011-02-12 Thread joy99
On Feb 13, 1:29 am, aspineux wrote: > Hi > > I'm releasing a .exe made with py2exe myself an got this problem too. > 99% of the time the required DLL is already installed by another > application and you don't need to care about it. > The 1% is about empty or fresh windows install (server most of

Re: Class or Dictionary?

2011-02-12 Thread Dan Stromberg
On Fri, Feb 11, 2011 at 10:20 PM, Steven D'Aprano wrote: > On Fri, 11 Feb 2011 21:47:32 -0800, Dan Stromberg wrote: > >> Did you have some sort of bad experience with pylint?  Do you resent the >> 20 minutes it takes to set it up? > > If you read my post more carefully and less defensively, you'll

Re: Class or Dictionary?

2011-02-12 Thread Martin De Kauwe
On Feb 13, 5:12 am, Terry Reedy wrote: > On 2/12/2011 1:24 AM, Martin De Kauwe wrote: > > > The point of this posting was just to ask those that know, whether it > > was a bad idea to use the class object in the way I had or was that > > OK? And if I should have just used a dictionary, why? > > Di

Re: parse html rendered by js

2011-02-12 Thread Miki Tebeka
> There seems no Rhino for linux. Rhino is written in Java. "java -jar js.jar" works fine on my Linux machine. -- http://mail.python.org/mailman/listinfo/python-list

[ANN] Benchmarker 3.0.1 released - a small benchmark utility

2011-02-12 Thread Makoto Kuwata
Hi, I released Benchmarker 3.0.1. http://pypi.python.org/pypi/Benchmarker/ Benchmarker is a small utility to benchmark your code. *NOTICE* This release doesn't have compatibility with release 2.0.0. Download http://pypi.python.org/pypi/Benchmarker/ Installation:: ## if you have

Re: parse html rendered by js

2011-02-12 Thread yanghq
There seems no Rhino for linux. Spidermonkey won't support document , window and something else in js, so it won't help me a lot. On Sat, 2011-02-12 at 05:57 -0800, john wrote: > Even though I've never tried it, you may want to look into running the html > thru a separate javascript engine, lik

Re: Arrays/List, filters, Pytho, Ruby

2011-02-12 Thread Arnaud Delobelle
Arnaud Delobelle writes: > "LL.Snark" writes: > >> Hi, >> >> I'm looking for a pythonic way to translate this short Ruby code : >> t=[6,7,8,6,7,9,8,4,3,6,7] >> i=t.index {|x| x> > > In Python3: > t = [6,7,8,6,7,9,8,4,3,6,7] next(filter(t[0].__gt__, t)) > 4 Oops! I realised my mistake

Re: executing a function with feeding its global variables

2011-02-12 Thread Jean-Daniel
On Sat, Feb 12, 2011 at 7:25 PM, Peter Otten <__pete...@web.de> wrote: > Jean-Daniel wrote: > >> Hello, >> >> I am writing a small framework where the user which writes a function >> can expect some global variable to be set in the function namespace. >> >> The user has to write a function like thi

Re: Arrays/List, filters, Pytho, Ruby

2011-02-12 Thread Arnaud Delobelle
"LL.Snark" writes: > Hi, > > I'm looking for a pythonic way to translate this short Ruby code : > t=[6,7,8,6,7,9,8,4,3,6,7] > i=t.index {|x| x In Python3: >>> t = [6,7,8,6,7,9,8,4,3,6,7] >>> next(filter(t[0].__gt__, t)) 4 -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Unpacking multiple dictionaries in a function?

2011-02-12 Thread Peter Otten
Paul Rubin wrote: > Martin De Kauwe writes: >> def wrapper(*old_dicts): >> dict={} >> for d in old_dicts: >> dict.update(d) >> return f(**dict) > > Untested: > > from itertools import chain > def wrapper(*old_dicts): >return f(**dict(chain

Re: Unpacking multiple dictionaries in a function?

2011-02-12 Thread Paul Rubin
Martin De Kauwe writes: > def wrapper(*old_dicts): > dict={} > for d in old_dicts: > dict.update(d) > return f(**dict) Untested: from itertools import chain def wrapper(*old_dicts): return f(**dict(chain(d.iteritems() for d in old_dicts))) -

Re: Question on Creating exe file with py2exe

2011-02-12 Thread aspineux
Hi I'm releasing a .exe made with py2exe myself an got this problem too. 99% of the time the required DLL is already installed by another application and you don't need to care about it. The 1% is about empty or fresh windows install (server most of the time) For them, I provide a link to the M$ v

Question on Creating exe file with py2exe

2011-02-12 Thread joy99
Dear Room, I am using Windows XP (SP2) and a Python Version "Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32". I was looking to create exe files. Reviewing various posts here, I felt py2exe may be the best thing I can opt for. But for Python2.6 I found the f

generating .zip including __main__.py file in top root using distutils

2011-02-12 Thread aspineux
Python 2.6 can run a zip file, searching for __main__.py in the root of the zip archive and running it. How can I create such an archive using distutils (and not setuptools) ? If I use # python setup.py bdist --format=zip I get a "dumb" zip file with a deep tree structure from "/" and I cannot put

Re: Unpacking multiple dictionaries in a function?

2011-02-12 Thread Chris Rebert
On Sat, Feb 12, 2011 at 9:08 AM, Martin De Kauwe wrote: > Hi, > > Is there a better way to unpack more than one dictionary in a function > than... > > def unpack_dicts(f): >    def wrapper(*old_dicts): >        dict={} I wouldn't call the variable "dict" since that clashes with the name of the bu

Re: Unpacking multiple dictionaries in a function?

2011-02-12 Thread Peter Otten
Martin De Kauwe wrote: > Is there a better way to unpack more than one dictionary in a function > than... > > def unpack_dicts(f): > def wrapper(*old_dicts): > dict={} > for d in old_dicts: > dict.update(d) > return f(**dict) > return wrapper > > @unp

Re: executing a function with feeding its global variables

2011-02-12 Thread Peter Otten
Jean-Daniel wrote: > Hello, > > I am writing a small framework where the user which writes a function > can expect some global variable to be set in the function namespace. > > The user has to write a function like this: > """ > # function.py > from framework import, command, run > > @command >

Re: Class or Dictionary?

2011-02-12 Thread Terry Reedy
On 2/12/2011 1:24 AM, Martin De Kauwe wrote: The point of this posting was just to ask those that know, whether it was a bad idea to use the class object in the way I had or was that OK? And if I should have just used a dictionary, why? Did you miss my suggestion to use a module rather than a

executing a function with feeding its global variables

2011-02-12 Thread Jean-Daniel
Hello, I am writing a small framework where the user which writes a function can expect some global variable to be set in the function namespace. The user has to write a function like this: """ # function.py from framework import, command, run @command def myfunc(): print HOST if __name__==

Unpacking multiple dictionaries in a function?

2011-02-12 Thread Martin De Kauwe
Hi, Is there a better way to unpack more than one dictionary in a function than... def unpack_dicts(f): def wrapper(*old_dicts): dict={} for d in old_dicts: dict.update(d) return f(**dict) return wrapper @unpack_dicts def some_func(a=None, b=None, c=No

Re: Shared memory python between two separate shell-launched processes

2011-02-12 Thread Adam Skutt
On Feb 12, 3:29 am, John Nagle wrote: > >     If you're having trouble debugging a sequential program, > you do not want to add shared memory to the problem. No, you don't want to add additional concurrent threads of execution. But he's not doing that, he's just preloading stuff into RAM. It's n

Re: parse html rendered by js

2011-02-12 Thread john
Even though I've never tried it, you may want to look into running the html thru a separate javascript engine, like spidermonkey or rhino, and then parse the results of that. On Friday, February 11, 2011 2:20:32 AM UTC-6, yanghq wrote: > hi, > I wanna get attribute value like href,src... in

Re: Class or Dictionary?

2011-02-12 Thread Martin De Kauwe
On Feb 12, 8:06 pm, Martin De Kauwe wrote: > On Feb 12, 7:21 pm, Andrea Crotti wrote: > > > Il giorno 12/feb/2011, alle ore 00.45, Martin De Kauwe ha scritto: > > > > Hi, > > > > yes I read a .INI file using ConfigParser, just similar sections (in > > > my opinion) to make one object which i can

Re: Class or Dictionary?

2011-02-12 Thread Martin De Kauwe
On Feb 12, 7:21 pm, Andrea Crotti wrote: > Il giorno 12/feb/2011, alle ore 00.45, Martin De Kauwe ha scritto: > > > Hi, > > > yes I read a .INI file using ConfigParser, just similar sections (in > > my opinion) to make one object which i can then pass to different > > classes. E.G. > > Ok then I s

Re: Class or Dictionary?

2011-02-12 Thread Martin De Kauwe
On Feb 12, 7:22 pm, John Nagle wrote: > On 2/11/2011 6:56 AM, Martin De Kauwe wrote: > > > Hi, > > > I have a series of parameter values which i need to pass throughout my > > code (>100), in C I would use a structure for example. However in > > python it is not clear to me if it would be better t

Re: Shared memory python between two separate shell-launched processes

2011-02-12 Thread John Nagle
On 2/10/2011 9:21 AM, Charles Fox (Sheffield) wrote: On Feb 10, 3:43 pm, Jean-Paul Calderone wrote: On Feb 10, 9:30 am, "Charles Fox (Sheffield)" wrote: Thanks Jean-Paul, I'll have a think about this. I'm not sure if it will get me exactly what I want though, as I would need to keep unloadin

Re: For loop comprehensions

2011-02-12 Thread Benjamin S Wolf
On Feb 11, 3:47 pm, Westley Martínez wrote: > No, too confusing. Then people'll want compound loops e.g.: > > for a in b if c while d else return x: >     print('Ha ha I'm so clever!') On Feb 11, 6:34 pm, Steven D'Aprano wrote: > There's nothing wrong with writing > > for x in iterable: >     if

Re: Class or Dictionary?

2011-02-12 Thread John Nagle
On 2/11/2011 6:56 AM, Martin De Kauwe wrote: Hi, I have a series of parameter values which i need to pass throughout my code (>100), in C I would use a structure for example. However in python it is not clear to me if it would be better to use a dictionary or build a class object? Personally I t

Re: For loop comprehensions

2011-02-12 Thread Ian Kelly
On Fri, Feb 11, 2011 at 7:34 PM, Steven D'Aprano wrote: > On Fri, 11 Feb 2011 16:59:52 -0700, Ian Kelly wrote: > >> Why not allow the same thing in for-loop conditions? > > Because new syntax and new language features means more work. Somebody > has to write the code, make sure that it doesn't bre

Re: Class or Dictionary?

2011-02-12 Thread Andrea Crotti
Il giorno 12/feb/2011, alle ore 00.45, Martin De Kauwe ha scritto: > Hi, > > yes I read a .INI file using ConfigParser, just similar sections (in > my opinion) to make one object which i can then pass to different > classes. E.G. Ok then I suggest configobj, less buggy and much more powerful th

Re: parse html rendered by js

2011-02-12 Thread Javier Collado
Hello, 2011/2/11 yanghq : >    but for some pages rendered by js, like: You could use selenium or windmill to help you reproduce the contents of the web page in a browser so you can get the data from the DOM tree once the page has been rendered instead of by parsing the js. Best regards, Jav

Re: Arrays/List, filters, Pytho, Ruby

2011-02-12 Thread DouhetSukd
On Feb 11, 1:24 pm, "LL.Snark" wrote: > Hi, > > I'm looking for a pythonic way to translate this short Ruby code : > t=[6,7,8,6,7,9,8,4,3,6,7] > i=t.index {|x| x > If you don't know Ruby, the second line means : > What is the index, in array t, of the first element x such that x > If can write it