Re: Python is readable

2012-03-20 Thread Steve Howell
On Mar 20, 10:40 pm, Chris Angelico wrote: > On Wed, Mar 21, 2012 at 3:58 PM, Steve Howell wrote: > > So saying "push(stack, item)" or "push(item, stack)" seems very > > unsophisticated, almost assembly-like in syntax, albeit at a higher > > level conceptually than assembly. > > Perhaps it does,

Re: Python is readable

2012-03-20 Thread Chris Angelico
On Wed, Mar 21, 2012 at 3:58 PM, Steve Howell wrote: > So saying "push(stack, item)" or "push(item, stack)" seems very > unsophisticated, almost assembly-like in syntax, albeit at a higher > level conceptually than assembly. Perhaps it does, but "push(stack, item)" and "stack.push(item)" are so c

Re: Python is readable

2012-03-20 Thread Steve Howell
On Mar 20, 9:16 pm, Chris Angelico wrote: > On Wed, Mar 21, 2012 at 1:44 PM, Steve Howell wrote: > > I think it's a matter of perspective, so there's no right answer, but > > I always think of the program object as also being the grammatical > > object, with the implied subject/actor being Python

Re: Python is readable

2012-03-20 Thread Nathan Rice
>> One example is performing a series of transformations on a collection of >> data, with the intent of finding an element of that collection that >> satisfies a particular criterion.  If you separate out the individual >> transformations, you need to understand generators or you will waste >> spac

Re: Python is readable

2012-03-20 Thread Chris Angelico
On Wed, Mar 21, 2012 at 1:44 PM, Steve Howell wrote: > I think it's a matter of perspective, so there's no right answer, but > I always think of the program object as also being the grammatical > object, with the implied subject/actor being Python itself.  For > example, consider this code: > >  s

setup.py for an extension

2012-03-20 Thread Paulo da Silva
Hi all. I have a python extension (bindings for a C lib - no swig) and I would like to write a setup.py to build a source distribution pack. The extension consists of 3 files: foo.h foo.c foo.py that are placed in a eclipse directory /home//ECLIPSE/workspace/ext/src foo.h+foo.c are to be compile

Re: List comprehension/genexp inconsistency.

2012-03-20 Thread Steve Howell
On Mar 20, 3:50 pm, Ian Kelly wrote: > On Tue, Mar 20, 2012 at 3:16 PM, Dennis Lee Bieber > > wrote: > > On Tue, 20 Mar 2012 16:23:22 -0400, "J. Cliff Dyer" > > declaimed the following in > > gmane.comp.python.general: > > >> When trying to create a class with a dual-loop generator expression in

Re: Python is readable

2012-03-20 Thread Steve Howell
On Mar 20, 7:28 pm, Ben Finney wrote: > Steve Howell writes: > > Also, while the above idiom puts the verbs in the right order, it is > > still backward to me to say "noun.verb." You don't noun a verb. You > > verb a noun. > > When calling a method, the program object is the grammatical subject.

Re: Python is readable

2012-03-20 Thread Ben Finney
Steve Howell writes: > Also, while the above idiom puts the verbs in the right order, it is > still backward to me to say "noun.verb." You don't noun a verb. You > verb a noun. When calling a method, the program object is the grammatical subject. You don't verb the noun, and you don't noun a ver

Re: Python is readable

2012-03-20 Thread Steve Howell
On Mar 20, 5:22 pm, Steven D'Aprano wrote: > On Tue, 20 Mar 2012 15:28:25 -0400, Nathan Rice wrote: > > > What if you are composing > > three or four functions, each of which is conditional on the data?  If > > you extract things from a statement and assign them somewhat arbitrary > > names, you'v

Re: Python is readable

2012-03-20 Thread Steven D'Aprano
On Tue, 20 Mar 2012 15:28:25 -0400, Nathan Rice wrote: >>> This is one of my gripes with the dogmatic application of the "break >>> it into multiple statements" mantra of Python. >> >> I must admit I don't recognise that one, unless you're talking about >> "not everything needs to be a one liner".

Re: Python is readable

2012-03-20 Thread Steven D'Aprano
On Tue, 20 Mar 2012 16:34:21 -0400, Nathan Rice wrote: > I find help() to be mostly useless because of the clutter induced by > double under methods. I feel your pain, but perhaps I've just learned how to skim the output without being bogged down in reading every line, or perhaps because I most

Re: Python is readable

2012-03-20 Thread Kiuhnm
On 3/18/2012 1:57, Steven D'Aprano wrote: On 3/16/2012 21:04, Prasad, Ramit wrote: People spell your name Stephen, sometimes too. Thinking of changing it? Gore Vidal's quote has panache, a valid compensation for breaking the usual rule. How many other uses on that page are similar? He provide

Re: Python is readable

2012-03-20 Thread Kiuhnm
On 3/19/2012 16:27, Steven D'Aprano wrote: I believe that you are misunderstanding the descriptivist position. There are many sentences which are never said, or perhaps only said once. Most non-trivial spoken or written sentences are unique. That doesn't make them wrong or erroneous because "nobo

Re: List comprehension/genexp inconsistency.

2012-03-20 Thread Ian Kelly
On Tue, Mar 20, 2012 at 3:16 PM, Dennis Lee Bieber wrote: > On Tue, 20 Mar 2012 16:23:22 -0400, "J. Cliff Dyer" > declaimed the following in > gmane.comp.python.general: > >> >> When trying to create a class with a dual-loop generator expression in a >> class definition, there is a strange scopin

Re: Fabric Engine v1.0 released under AGPL

2012-03-20 Thread Paul Doyle
Hi Colin, Fabric supports multi-dimensional arrays, and also provides support for dictionaries. You can read more here: http://documentation.fabric-engine.com/latest/FabricEngine-KLProgrammingGuide.html In terms of comparison to Numpy - I'm not familiar with that product, but some surface level s

RE: urllib.urlretrieve never returns???

2012-03-20 Thread Prasad, Ramit
> > Traceback (most recent call last): > > > >File "C:\Python\Projects\Warehouserclient_v3\locedit.py", line 917, > > in GetThumbnail > > Traceback (most recent call last): > >File "C:\Python\Projects\Warehouserclient_v3\locedit.py", line 917, > > in GetThumbnail > >File "C:\Python\

RE: urllib.urlretrieve never returns??? [SOLVED] - workaround

2012-03-20 Thread Prasad, Ramit
> Everything works perfectly, in all modes: console, no console, started > directly and started in separate thread. > > So the problem with urllib must be. Maybe wxPython installs some except > hooks, or who knows? If somebody feels up to it, I can start narrowing > down the problem to the smalles

RE: urllib.urlretrieve never returns??? [SOLVED] - workaround

2012-03-20 Thread Prasad, Ramit
> > Everything works perfectly, in all modes: console, no console, started > > directly and started in separate thread. > > > > So the problem with urllib must be. Maybe wxPython installs some except > > hooks, or who knows? If somebody feels up to it, I can start narrowing > > down the problem to

RE: urllib.urlretrieve never returns???

2012-03-20 Thread Prasad, Ramit
> Today I got a different error message printed on console (program > started with python.exe) > > > > Unhandled exception in thread started by FrameLocEdit.GetThumbnail of Object of type 'wxPanel *' at 0x4f85300> > >>Unhandled exception in thread started by FrameLocEdit.GetThumbnail of Obj

Released: stackprint -- analyze python stack dumps in server logs

2012-03-20 Thread Roy Smith
Stackprint is a little tool for finding, formatting, and categorizing python stack dumps in server log files. We've found it useful for monitoring the health of our django applications. https://bitbucket.org/roysmith/python-tools. BSD license. -- http://mail.python.org/mailman/listinfo/python-

Re: urllib.urlretrieve never returns??? [SOLVED] - workaround

2012-03-20 Thread Laszlo Nagy
I'll be experimenting with pyCurl now. By replacing the GetThumbnail method with this brainless example, taken from the pyCurl demo: def GetThumbnail(self,imgurl): class Test: def __init__(self): self.contents = '' def body_callback(self,

Re: Python is readable

2012-03-20 Thread Nathan Rice
>>> The fact that scientific journal articles start with a documentation >>> string >>> called an abstract does not indicate that scientific English fails as a >>> human communication medium. Function docstrings say what the function >>> does >>> and how to use it without reading the code. They can

Re: Fabric Engine v1.0 released under AGPL

2012-03-20 Thread Colin J. Williams
On 20/03/2012 12:51 PM, Fabric Paul wrote: Hi everyone - just letting you know that we released v1.0 of Fabric Engine today. We've open-sourced the core under AGPL, so I hope that gives you an incentive to get started with high-performance for Python :) http://fabricengine.com/technology/benchma

List comprehension/genexp inconsistency.

2012-03-20 Thread J. Cliff Dyer
One of my coworkers just stumbled across an interesting issue. I'm hoping someone here can explain why it's happening. When trying to create a class with a dual-loop generator expression in a class definition, there is a strange scoping issue where the inner variable is not found, (but the outer

Re: Distribution

2012-03-20 Thread duncan smith
On 20/03/12 04:31, prince.pangeni wrote: Hi all, I am doing a simulation project using Python. In my project, I want to use some short of distribution to generate requests to a server. The request should have two distributions. One for request arrival rate (should be poisson) and another for

Re: urllib.urlretrieve never returns???

2012-03-20 Thread John Nagle
On 3/17/2012 9:34 AM, Chris Angelico wrote: 2012/3/18 Laszlo Nagy: In the later case, "log.txt" only contains "#1" and nothing else. If I look at pythonw.exe from task manager, then its shows +1 thread every time I click the button, and "#1" is appended to the file. Does it fail to retrieve

Re: urllib.urlretrieve never returns???

2012-03-20 Thread Laszlo Nagy
2012.03.20. 8:08 keltezéssel, Laszlo Nagy írta: Here you can find the example program and the original post. http://code.activestate.com/lists/python-list/617894/ I gather you are running urlretrieve in a separate thread, inside a GUI? Yes. I have learned that whenever I have inexplicable b

Re: Python is readable

2012-03-20 Thread Terry Reedy
On 3/20/2012 3:28 PM, Nathan Rice wrote: This is one of my gripes with the dogmatic application of the "break it into multiple statements" mantra of Python. I must admit I don't recognise that one, unless you're talking about "not everything needs to be a one liner". ... Perhaps you could give

Re: Python is readable

2012-03-20 Thread Nathan Rice
>> This is one of my gripes with the dogmatic application of the "break it >> into multiple statements" mantra of Python. > > I must admit I don't recognise that one, unless you're talking about "not > everything needs to be a one liner". > ... > Perhaps you could give some examples (actual or cont

Enforcing hash randomization (was: [RELEASED] Second release candidates for Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3)

2012-03-20 Thread Michael Ströder
Benjamin Peterson wrote: > Hash randomization causes the iteration order of dicts and sets to be > unpredictable and differ across Python runs. Python has never guaranteed > iteration order of keys in a dict or set, and applications are advised to > never > rely on it. Historically, dict iteration

Re: Python is readable

2012-03-20 Thread Terry Reedy
On 3/20/2012 12:55 PM, Nathan Rice wrote: I agree, docstrings/code comments are a pretty obvious indication that code (as it exists currently) fails as a human communication medium. The fact that scientific journal articles start with a documentation string called an abstract does not indicat

Re: Python is readable

2012-03-20 Thread Steven D'Aprano
On Tue, 20 Mar 2012 12:55:07 -0400, Nathan Rice wrote: > This is one of my gripes with the dogmatic application of the "break it > into multiple statements" mantra of Python. I must admit I don't recognise that one, unless you're talking about "not everything needs to be a one liner". > Not on

Re: Distribution

2012-03-20 Thread Laurent Claessens
Il 20/03/2012 12:21, Ben Finney ha scritto: "prince.pangeni" writes: I am doing a simulation project using Python. In my project, I want to use some short of distribution to generate requests to a server. I guess scipy is also available in plain python (didn't check), but the following

Fabric Engine v1.0 released under AGPL

2012-03-20 Thread Fabric Paul
Hi everyone - just letting you know that we released v1.0 of Fabric Engine today. We've open-sourced the core under AGPL, so I hope that gives you an incentive to get started with high-performance for Python :) http://fabricengine.com/technology/benchmarks/ - to give you an idea of the kind of per

Re: Python is readable

2012-03-20 Thread Nathan Rice
Just to troll the discussion a little bit more... On Sun, Mar 18, 2012 at 6:02 PM, Chris Angelico wrote: > On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky wrote: >> What I would say is that, when PROGRAMMERS look at Python code for the >> first time, they will understand what it does more readily

Re: code for computing and printing list of combinations

2012-03-20 Thread Tim Chase
On 03/20/12 09:59, Joi Mond wrote: To All, Can someone help me with the proper code to compute combinations for n=7, r=5 for the following list of numbers: 7, 8, 10, 29, 41, 48, 55. There should be 21 combination. Also once there list is made can a code be written to add (sum) each of the set of

Re: code for computing and printing list of combinations

2012-03-20 Thread Peter Otten
Joi Mond wrote: > Can someone help me with the proper code to compute combinations for n=7, > r=5 for the following list of numbers: 7, 8, 10, 29, 41, 48, 55. There > should be 21 combination. Also once there list is made can a code be > written to add (sum) each of the set of five number in the t

code for computing and printing list of combinations

2012-03-20 Thread Joi Mond
To All, Can someone help me with the proper code to compute combinations for n=7, r=5 for the following list of numbers: 7, 8, 10, 29, 41, 48, 55. There should be 21 combination. Also once there list is made can a code be written to add (sum) each of the set of five number in the the list. For e

Re: s_push parser stack overflow

2012-03-20 Thread alister ware
On Tue, 20 Mar 2012 04:30:51 +, MRAB wrote: > On 20/03/2012 03:19, Артём Назаров wrote: >> Hi. >> Sorry of my english :-) >> >> code: >> print >> (((0)))

Re: Eclipse, C, and Python

2012-03-20 Thread Steven D'Aprano
On Mon, 19 Mar 2012 23:00:50 -0700, Richard Medina Calderon wrote: > Hello Forum. I have installed Python comnpiler in Eclipse Classic for > Windows. After a while I have installed the C compiler. However, somehow > now when I try to run my code in Python it shows me for default Ant > > Run -->An

Re: Distribution

2012-03-20 Thread Robert Kern
On 3/20/12 4:31 AM, prince.pangeni wrote: Hi all, I am doing a simulation project using Python. In my project, I want to use some short of distribution to generate requests to a server. The request should have two distributions. One for request arrival rate (should be poisson) and another for

Re: pypi and dependencies

2012-03-20 Thread Donald Stufft
packaging (in 3.3) and distutils2 (2.x-3.2) is a new metadata format for python packages. It gets rid of setup.py and it includes a way to specify the requirements that your package needs. This will show up on PyPI/Crate. On Tuesday, March 20, 2012 at 8:01 AM, Andrea Crotti wrote: > On 03/20/2

Re: pypi and dependencies

2012-03-20 Thread Andrea Crotti
On 03/20/2012 11:18 AM, Ben Finney wrote: Andrea Crotti writes: When I publish something on Pypi, is there a way to make it fetch the list of dependencies needed by my project automatically? It would be nice to have it in the Pypi page, without having to look at the actual code.. Sadly, no.

Re: Distribution

2012-03-20 Thread Robert Kern
On 3/20/12 11:21 AM, Ben Finney wrote: "prince.pangeni" writes: I am doing a simulation project using Python. In my project, I want to use some short of distribution to generate requests to a server. What is a distribution? That term already means something in Python jargon, and it doesn

Re: Python is readable

2012-03-20 Thread Albert van der Horst
In article , Chris Angelico wrote: >On Mon, Mar 19, 2012 at 12:23 PM, Steven D'Aprano > wrote: >> On Mon, 19 Mar 2012 09:02:06 +1100, Chris Angelico wrote: >> >>> On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky >>> wrote: What I would say is that, when PROGRAMMERS look at Python code for the

Re: Distribution

2012-03-20 Thread Ben Finney
"prince.pangeni" writes: >I am doing a simulation project using Python. In my project, I want > to use some short of distribution to generate requests to a server. What is a distribution? That term already means something in Python jargon, and it doesn't match the rest of your use case. So

Re: pypi and dependencies

2012-03-20 Thread Ben Finney
Andrea Crotti writes: > When I publish something on Pypi, is there a way to make it fetch the list > of dependencies needed by my project automatically? > > It would be nice to have it in the Pypi page, without having to look at the > actual code.. Sadly, no. The metadata available for packages

Re: Eclipse, C, and Python

2012-03-20 Thread Martin P. Hellwig
On 20/03/2012 06:00, Richard Medina Calderon wrote: Hello Forum. I have installed Python comnpiler in Eclipse Classic for Windows. After a while I have installed the C compiler. However, somehow now when I try to run my code in Python it shows me for default Ant Run -->Ant Build I switched my

Re: Currying in Python

2012-03-20 Thread Kiuhnm
On 3/20/2012 8:11, Arnaud Delobelle wrote: On 19 March 2012 23:20, Ian Kelly wrote: I hope you don't mind if I critique your code a bit! On Fri, Mar 16, 2012 at 7:21 PM, Kiuhnm wrote: Here we go. ---> def genCur(f, unique = True, minArgs = -1): It is customary in Python for unsupplied ar

Re: Currying in Python

2012-03-20 Thread Kiuhnm
On 3/20/2012 0:20, Ian Kelly wrote: Since you're writing this for Python 3 (as evidenced by the use of the nonlocal keyword), you could take advantage here of the fact that Python 3 dictionary views behave like sets. Also, you should use a more specific exception type: As a side note, "nonloca

Re: Distribution

2012-03-20 Thread Peter Otten
prince.pangeni wrote: > Hi all, >I am doing a simulation project using Python. In my project, I want > to use some short of distribution to generate requests to a server. > The request should have two distributions. One for request arrival > rate (should be poisson) and another for request mix

Re: Currying in Python

2012-03-20 Thread Arnaud Delobelle
On 19 March 2012 23:20, Ian Kelly wrote: > I hope you don't mind if I critique your code a bit! > > On Fri, Mar 16, 2012 at 7:21 PM, Kiuhnm > wrote: >> Here we go. >> >> ---> >> def genCur(f, unique = True, minArgs = -1): > > It is customary in Python for unsupplied arguments with no default to >

Re: urllib.urlretrieve never returns???

2012-03-20 Thread Laszlo Nagy
Here you can find the example program and the original post. http://code.activestate.com/lists/python-list/617894/ I gather you are running urlretrieve in a separate thread, inside a GUI? Yes. I have learned that whenever I have inexplicable behaviour in a function, I should check my assumpt