Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Larry Hudson
On 03/16/2012 05:45 AM, Ray Song wrote: I confess i've indulged in Haskell and found f a more readable than f(a) And why aren't functions curried (partially applied function is another function which takes the rest arguments) by default? Thanks in advance for any suggestions. -- Ra

Question about python 3.2 distutils

2012-03-16 Thread Collin Day
Hi all, I have a question about python 3.2 distutils on a Gentoo amd64 system. When I open an ipython session and import distutils.unixcompiler and then check the shared library extension with UnixCCompiler.shared)lib_extension, it returns '.so', as I would expect. When I run a setup.py in

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-16 Thread Chris Rebert
On Fri, Mar 16, 2012 at 10:30 PM, Cosmia Luna wrote: > I'm porting my existing work to Python 3.X, but... > > class Foo: >    def bar(self): >        pass > > mthd = Foo.bar > > assert mthd.im_class is Foo # this does not work in py3k > > So, how can I get a reference to Foo? This is important whe

How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-16 Thread Cosmia Luna
I'm porting my existing work to Python 3.X, but... class Foo: def bar(self): pass mthd = Foo.bar assert mthd.im_class is Foo # this does not work in py3k So, how can I get a reference to Foo? This is important when writing decorators, the only way I can think out is: class Foo:

Haskellizing python (was Why not use juxtaposition to indicate function application)

2012-03-16 Thread rusi
On Mar 16, 5:45 pm, Ray Song wrote: > I confess i've indulged in Haskell and found >     f a > more readable than >     f(a) > > And why aren't functions curried (partially applied function is another > function which takes the rest arguments) by default? > > Thanks in advance for any suggestions

Re: Does anyone actually use PyPy in production?

2012-03-16 Thread Terry Reedy
On 3/16/2012 9:44 PM, John Nagle wrote: Does anyone run PyPy in production? The pypy list, accessible via gmane, might be a better place to ask. But my impression is yes, and that they are getting commercial $$$ support. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-l

Re: Python is readable

2012-03-16 Thread Terry Reedy
On 3/16/2012 9:08 AM, Neil Cerutti wrote: A grammarian always uses complete sentence before a colon, even when introducing a list. The Chicago Manual of Style*, 13th edition, says "The colon is used to mark a discontinuity of grammatical construction greater than that indicated by the semico

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Terry Reedy
On 3/16/2012 9:14 AM, bruno.desthuilli...@gmail.com wrote: On Mar 16, 1:45 pm, Ray Song wrote: I confess i've indulged in Haskell and found f a more readable than f(a) Hmmm... What about: f a b versus f(a(b)) or was it supposed to be read as f(a)(b) or as

Re: Daemonization / Popen / pipe issue

2012-03-16 Thread John O'Hagan
On Fri, 16 Mar 2012 22:12:14 -0400 Lee Clemens wrote: > > I have a multi-threaded application, each thread has an instance of a class > which calls Popen. The command(s) being executed (shell=True) include pipes. > The errors I have seen involve "broken pipe" and unexepected output (as > demons

Re: Currying in Python

2012-03-16 Thread Steven D'Aprano
On Sat, 17 Mar 2012 01:46:59 +, Steven D'Aprano wrote: > On Sat, 17 Mar 2012 02:21:32 +0100, Kiuhnm wrote: > >> Here we go. > [snip code] > > > Have you looked at functools.partial? > > > import functools > new_func = functools.partial(func, ham, spam=23) > > > (I am aware that, technic

Daemonization / Popen / pipe issue

2012-03-16 Thread Lee Clemens
Hello, I am new to the list, have many years of Java experience but an fairly new to Python. I am hoping this is an issue caused by my misuse of Python in a multi-threaded way, but so far no one has identified such to me. I have a multi-threaded application, each thread has an instance of a cl

PIL for py3k not picking up external libraries

2012-03-16 Thread Collin Day
Hi all, I am using python 3.2 on an amd64 Gentoo system. I was trying to compile an unofficial version of PIL to work in 3.2 that I found here: http://www.lfd.uci.edu/~gohlke/pythonlibs Anyway, when I run the setup.py to compile the source, it doesn't pick up tkinter, zlib, or freetype. Wh

Re: Python simulate browser activity

2012-03-16 Thread NA
selenium is the best bet. http://github.com/antlong/selenium -- http://mail.python.org/mailman/listinfo/python-list

Re: Currying in Python

2012-03-16 Thread Steven D'Aprano
On Sat, 17 Mar 2012 02:21:32 +0100, Kiuhnm wrote: > Here we go. [snip code] Have you looked at functools.partial? import functools new_func = functools.partial(func, ham, spam=23) (I am aware that, technically, currying and partial function application are not quite the same thing, but it s

Does anyone actually use PyPy in production?

2012-03-16 Thread John Nagle
Does anyone run PyPy in production? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Currying in Python

2012-03-16 Thread Kiuhnm
Here we go. ---> def genCur(f, unique = True, minArgs = -1): """ Generates a 'curried' version of a function. """ def geng(curArgs, curKwargs): def g(*args, **kwargs): nonlocal f, curArgs, curKwargs, minArgs;# our STATIC data if len(args) or len(kwargs)

Re: avoid import short-circuiting

2012-03-16 Thread Robert Kern
On 3/16/12 11:14 PM, Andrea Crotti wrote: Very nice thanks, here it is class ImportMock: def _my_import(self, *args, **kwargs): self.ls.append(args[0]) self.orig(*args, **kwargs) There's a bug here. You need to return the module object you got from calling self.orig(). By

Re: Python is readable

2012-03-16 Thread Michael Torrie
On 03/16/2012 10:48 AM, Steven D'Aprano wrote: > On Fri, 16 Mar 2012 13:10:12 +0100, Kiuhnm wrote: > >> Maybe we should define *exactly* what readability is (in less then 500 >> lines, if possible). > > If you can't be bothered to read my post before replying, save yourself > some more time and

Re: avoid import short-circuiting

2012-03-16 Thread Andrea Crotti
On 03/16/2012 10:20 PM, Robert Kern wrote: On 3/16/12 10:04 PM, Andrea Crotti wrote: On 03/16/2012 05:19 PM, Robert Kern wrote: On 3/16/12 4:49 PM, Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what ex

Re: avoid import short-circuiting

2012-03-16 Thread Robert Kern
On 3/16/12 10:04 PM, Andrea Crotti wrote: On 03/16/2012 05:19 PM, Robert Kern wrote: On 3/16/12 4:49 PM, Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an

Re: avoid import short-circuiting

2012-03-16 Thread Ian Kelly
On Fri, Mar 16, 2012 at 4:04 PM, Andrea Crotti wrote: >> You want to monkeypatch __builtin__.__import__() instead. It always gets >> called. >> > > Seems like a good idea :) > > My first attempt failes though > > > def full(module): >    from __builtin__ import __import__ >    ls = [] >    orig =

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Serhiy Storchaka
16.03.12 23:02, Chris Rebert написав(ла): On Fri, Mar 16, 2012 at 1:57 PM, Serhiy Storchaka wrote: lambda:f Doesn't help; wouldn't the lambda be implicitly called? No, the lambda is only for declaration. I prefer to use braces for lambda syntax, it will be fine with 'if' and 'while' functi

Re: avoid import short-circuiting

2012-03-16 Thread Andrea Crotti
On 03/16/2012 05:19 PM, Robert Kern wrote: On 3/16/12 4:49 PM, Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an import hook. It works quite well for sma

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Chris Rebert
On Fri, Mar 16, 2012 at 1:57 PM, Serhiy Storchaka wrote: > 16.03.12 18:45, Steven D'Aprano написав(ла): >> If f is a function which normally takes (for the sake of the argument) >> one argument, then f would call the function with no arguments (which may >> return a curried function, or may apply

Re: Python is readable

2012-03-16 Thread Chris Angelico
On Sat, Mar 17, 2012 at 7:30 AM, Ethan Furman wrote: > Neil Cerutti wrote: >> >> I am not pedantic. You are wrong. >> > > When saying somebody is wrong, you really should back it up with references > (wiki, dictionary, etc.). I interpret this simply as a witty statement, one that can be thrown in

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Serhiy Storchaka
16.03.12 18:45, Steven D'Aprano написав(ла): If f is a function which normally takes (for the sake of the argument) one argument, then f would call the function with no arguments (which may return a curried function, or may apply default arguments, or perhaps raise an exception). So how would you

Re: Is it technically possible to give Python option of naming process of running script?

2012-03-16 Thread Grant Edwards
On 2012-03-16, Prasad, Ramit wrote: > >> One possible problem with linking from one's home directory is that >> home directories are often on different filesystems than /usr/bin (or >> wherever python is). Using a symlink doesn't work, the process name >> still ends up as python2.6 (or whatever t

Re: Python is readable

2012-03-16 Thread Ethan Furman
Neil Cerutti wrote: On 2012-03-16, Steven D'Aprano wrote: Ah, perhaps you're talking about *prescriptivist* grammarians, who insist on applying grammatical rules that exist only in their own fevered imagination. Sorry, I was talking about the other sort, the ones who apply the grammatical rules

Re: cannot open shared object file

2012-03-16 Thread Dan Stromberg
A suggestion: 1) strace it. http://stromberg.dnsalias.org/~strombrg/debugging-with-syscall-tracers.html 2) Show the output to a C programmer, or take some educated guesses yourself. On Thu, Mar 15, 2012 at 11:47 PM, Steven Lo wrote: > ** > > Hi, > > We are getting the following error during a 'm

RE: Is it technically possible to give Python option of naming process of running script?

2012-03-16 Thread Prasad, Ramit
> I was thinging about daemons and system-type stuff. > > One possible problem with linking from one's home directory is that > home directories are often on different filesystems than /usr/bin (or > wherever python is). Using a symlink doesn't work, the process name > still ends up as python2.6

RE: Python is readable

2012-03-16 Thread Prasad, Ramit
> 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 provided common examples and reference links. Seems like a pretty reasonable way of tryin

Re: Python is readable

2012-03-16 Thread Mel Wilson
Steven D'Aprano wrote: > On Fri, 16 Mar 2012 17:53:24 +, Neil Cerutti wrote: > >> On 2012-03-16, Steven D'Aprano >> wrote: >>> Ah, perhaps you're talking about *prescriptivist* grammarians, who >>> insist on applying grammatical rules that exist only in their own >>> fevered imagination. Sor

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Steven D'Aprano wrote: > On Fri, 16 Mar 2012 17:53:24 +, Neil Cerutti wrote: > >> On 2012-03-16, Steven D'Aprano >> wrote: >>> Ah, perhaps you're talking about *prescriptivist* grammarians, who >>> insist on applying grammatical rules that exist only in their own >>> fevered im

Re: Python simulate browser activity

2012-03-16 Thread Chris Angelico
On Fri, Mar 16, 2012 at 1:23 PM, choi2k wrote: > The application aims to simulate user activity including visit a > website and perform some interactive actions (click on the menu, > submit a form, redirect to another pages...etc) > I have found some libraries / plugins which aims to simulate brow

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 17:53:24 +, Neil Cerutti wrote: > On 2012-03-16, Steven D'Aprano > wrote: >> Ah, perhaps you're talking about *prescriptivist* grammarians, who >> insist on applying grammatical rules that exist only in their own >> fevered imagination. Sorry, I was talking about the other

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Ian Kelly
On Fri, Mar 16, 2012 at 10:45 AM, Steven D'Aprano wrote: > On Fri, 16 Mar 2012 17:31:06 +0100, Kiuhnm wrote: > >> You wouldn't, because Haskel's way is more regular and makes a lot of >> sense: parentheses are for grouping and that's it. > > If f is a function which normally takes (for the sake of

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Steven D'Aprano wrote: > Ah, perhaps you're talking about *prescriptivist* grammarians, > who insist on applying grammatical rules that exist only in > their own fevered imagination. Sorry, I was talking about the > other sort, the ones who apply the grammatical rules used by > peop

Re: avoid import short-circuiting

2012-03-16 Thread Robert Kern
On 3/16/12 4:49 PM, Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an import hook. It works quite well for small examples but the main problem is that once

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Kiuhnm
On 3/16/2012 17:45, Steven D'Aprano wrote: On Fri, 16 Mar 2012 17:31:06 +0100, Kiuhnm wrote: You wouldn't, because Haskel's way is more regular and makes a lot of sense: parentheses are for grouping and that's it. If f is a function which normally takes (for the sake of the argument) one argu

RE: Python is readable

2012-03-16 Thread Prasad, Ramit
> >> I don't understand the reason for $arg1 and $arg2. Is there some reason > >> why the code couldn't do this instead? > >> > >> my(@list1, @list2) = @_; > > > > @_ contains references to arrays. You can't pass two arrays to a > > function. > > > Why ever not? That seems like basic func

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 17:25, Steven D'Aprano wrote: On Fri, 16 Mar 2012 13:55:06 +0100, Kiuhnm wrote: I don't understand the reason for $arg1 and $arg2. Is there some reason why the code couldn't do this instead? my(@list1, @list2) = @_; @_ contains references to arrays. You can't pass two

Re: avoid import short-circuiting

2012-03-16 Thread Ethan Furman
Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an import hook. It works quite well for small examples but the main problem is that once a module is impor

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:10:12 +0100, Kiuhnm wrote: > Maybe we should define *exactly* what readability is (in less then 500 > lines, if possible). If you can't be bothered to read my post before replying, save yourself some more time and don't bother to reply at all. I quote from the part of the

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 17:31:06 +0100, Kiuhnm wrote: > You wouldn't, because Haskel's way is more regular and makes a lot of > sense: parentheses are for grouping and that's it. If f is a function which normally takes (for the sake of the argument) one argument, then f would call the function with

avoid import short-circuiting

2012-03-16 Thread Andrea Crotti
I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an import hook. It works quite well for small examples but the main problem is that once a module is imported it's added to sys.

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Kiuhnm
On 3/16/2012 17:13, Prasad, Ramit wrote: I confess i've indulged in Haskell and found f a more readable than f(a) Hmmm... What about: f a b versus f(a(b)) or was it supposed to be read as f(a)(b) or as f(a, b) ?-) That would be f (a b)

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:08:49 +, Neil Cerutti wrote: > On 2012-03-16, Steven D'Aprano > wrote: >> A grammarian might very well write: >> >> Your assignment, if you choose to accept it, is to: >> >> 1. Take the bus to Swansea. >> ... >> >> In English, one typical use for colons is to introduce

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:55:06 +0100, Kiuhnm wrote: >> I don't understand the reason for $arg1 and $arg2. Is there some reason >> why the code couldn't do this instead? >> >> my(@list1, @list2) = @_; > > @_ contains references to arrays. You can't pass two arrays to a > function. Why eve

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Robert Kern
On 3/16/12 12:45 PM, Ray Song wrote: I confess i've indulged in Haskell and found f a more readable than f(a) And why aren't functions curried (partially applied function is another function which takes the rest arguments) by default? Python isn't a strongly functional language. We

RE: Why not use juxtaposition to indicate function application

2012-03-16 Thread Prasad, Ramit
> >> I confess i've indulged in Haskell and found > >> f a > >> more readable than > >> f(a) > > > > Hmmm... What about: > > > > f a b > > > > versus > > > > f(a(b)) > > > > or was it supposed to be read as > > > > f(a)(b) > > > > > > or as > > > > f(a, b) > > > > ?-) >

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Kiuhnm
On 3/16/2012 14:14, bruno.desthuilli...@gmail.com wrote: On Mar 16, 1:45 pm, Ray Song wrote: I confess i've indulged in Haskell and found f a more readable than f(a) Hmmm... What about: f a b versus f(a(b)) or was it supposed to be read as f(a)(b) or as f(

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Colin J. Williams
On 16/03/2012 8:45 AM, Ray Song wrote: I confess i've indulged in Haskell and found f a more readable than f(a) And why aren't functions curried (partially applied function is another function which takes the rest arguments) by default? Thanks in advance for any suggestions. -- Ray

Re: Is it technically possible to give Python option of naming process of running script?

2012-03-16 Thread Grant Edwards
On 2012-03-16, Chris Angelico wrote: > On Fri, Mar 16, 2012 at 5:39 AM, Grant Edwards > wrote: >> Seems like an awfully obtuse way of doing things -- I don't really >> want to have 15 different copies of Python (or even links), and it >> requires root privleges every time you want to run a Pytho

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread bruno.desthuilli...@gmail.com
On Mar 16, 1:45 pm, Ray Song wrote: > I confess i've indulged in Haskell and found >     f a > more readable than >     f(a) Hmmm... What about: f a b versus f(a(b)) or was it supposed to be read as f(a)(b) or as f(a, b) ?-) > And why aren't functions curried (partially

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Steven D'Aprano wrote: > A grammarian might very well write: > > Your assignment, if you choose to accept it, is to: > > 1. Take the bus to Swansea. > ... > > In English, one typical use for colons is to introduce a list > or sequence of items, including instructions. A sequence of

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:36:25 +0100, Kiuhnm wrote: > On 3/16/2012 0:52, Steven D'Aprano wrote: >> It is *remarkable* how people take the colon for granted. It is so >> simple and so obvious that they use it in their own writing often >> without thinking about it, but because it is not strictly nec

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 2:53, Steven D'Aprano wrote: On Thu, 15 Mar 2012 00:34:47 +0100, Kiuhnm wrote: I've just started to read The Quick Python Book (2nd ed.) Is this the one? http://manning.com/ceder/ The author claims that Python code is more readable than Perl code and provides this example

Re: Python simulate browser activity

2012-03-16 Thread Roy Smith
In article <214c4c0c-f8ec-4030-946b-8becc8e1a...@ur9g2000pbc.googlegroups.com>, choi2k wrote: > Hi, everyone > > I am trying to write a small application using python but I am not > sure whether it is possible to do so.. > The application aims to simulate user activity including visit a > webs

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Kiuhnm wrote: > As you can see, I'm not an English native speaker, but I think > I know a few things about punctuation. We second language > learners remember all the wrong things :( English's punctuation rules have to be a lot easier to remember than the seemingly random way in wh

Why not use juxtaposition to indicate function application

2012-03-16 Thread Ray Song
I confess i've indulged in Haskell and found f a more readable than f(a) And why aren't functions curried (partially applied function is another function which takes the rest arguments) by default? Thanks in advance for any suggestions. -- Ray -- http://mail.python.org/mailman/listinf

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 0:52, Steven D'Aprano wrote: On Fri, Mar 16, 2012 at 1:30 AM, Kiuhnm wrote: Sorry, but I can't see how it would make it harder for humans to understand. Are there particular situations you're referring to? In a trivial example, it's mostly just noise: if a == b# who needs t

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 4:55, Steven D'Aprano wrote: On Fri, 16 Mar 2012 00:32:52 +0100, Kiuhnm wrote: Pick up two math books about the same topic but on two different levels (e.g. under-graduated and graduated). If you compare the proofs you'll see that those in the higher-level book are almost always sk

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 0:58, Mark Lawrence wrote: On 15/03/2012 23:46, Kiuhnm wrote: On 3/16/2012 0:00, Arnaud Delobelle wrote: On 15 March 2012 22:35, Ben Finney wrote: Kiuhnm writes: Moreover, I think that if ( ): is not ver

AW: Android

2012-03-16 Thread Szabo, Patrick (LNG-VIE)
You might be interested in this: http://www.linuxjournal.com/article/10940 I had this installed on my Desire and it ran pretty nicely. regards Von: python-list-bounces+patrick.szabo=lexisnexis...@python.org [mailto:python-list-bounces

Android

2012-03-16 Thread Peter Condon
Dear Sirs, I am a new student learning this and am getting an Android tablet for my birthday will python be able to run on android? Kindest regards Peter This email and any attachments to it may contain information which is confidential, legally privileged, subject to the Official S

Re: Python is readable

2012-03-16 Thread Duncan Booth
Thomas Rachel wrote: >> Or, more likely, lock creates an object which keeps the lock "acquired". >> The lock is released when we leave the block. >> So we could inspect the lock with >> with lock as l: >> inspect l... >> do_some. > > Or just inspect l - I don't know if a lock's __enter__ met

new release 0.38 of OpenOpt, FuncDesigner, SpaceFuncs, DerApproximator

2012-03-16 Thread dmitrey
Hi all, I'm glad to inform you about new release 0.38 (2012-March-15): OpenOpt: interalg can handle discrete variables interalg can handle multiobjective problems (MOP) interalg can handle problems with parameters fixedVars/freeVars Many interalg improvements and some bugfixes

Re: Is it technically possible to give Python option of naming process of running script?

2012-03-16 Thread xliiv
> > Seems like an awfully obtuse way of doing things -- I don't really > > want to have 15 different copies of Python (or even links), and it > > requires root privleges every time you want to run a Python program > > with the "correct" name. > > Why do you need root? Can't you copy / link into y

cannot open shared object file

2012-03-16 Thread Steven Lo
Hi, We are getting the following error during a 'make' process on a CentOS release 5.4 system: Running mkfontdir... Creating SELinux policy... /usr/bin/python: error while loading shared libraries: libpython2.4.so.1.0: cannot open shared object file: No such file or directory However, we