Re: unladen swallow: python and llvm

2009-06-07 Thread Tim Wintle
On Sun, 2009-06-07 at 16:40 -0600, Brian wrote: > On Fri, Jun 5, 2009 at 3:29 AM, Nick Craig-Wood > wrote: > It is an interesting idea for a number of reasons, the main > one as far > as I'm concerned is that it is more of a port of CPython to a > new > arch

Re: unladen swallow: python and llvm

2009-06-07 Thread Kay Schluehr
On 8 Jun., 00:31, bearophileh...@lycos.com wrote: > ShedSkin (SS) is a beast almost totally different from CPython, SS > compiles an implicitly static subset of Python to C++. So it breaks > most real Python programs, and it doesn't use the Python std lib (it > rebuilds one in C++ or compiled Pyth

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread Mark Tolonen
"higer" wrote in message news:0c786326-1651-42c8-ba39-4679f3558...@r13g2000vbr.googlegroups.com... On Jun 7, 11:25 pm, John Machin wrote: On Jun 7, 10:55 pm, higer wrote: > My file contains such strings : > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a Are you sure? Does that occupy 9 bytes in

Re: pylint naming conventions?

2009-06-07 Thread Ben Finney
David Stanek writes: > On Sun, Jun 7, 2009 at 9:23 AM, Esmail wrote: > > I'll try to come up with a nice short code example in the next few > > days to demonstrate what I think the problem is and post it, thanks > > for the suggestion. > > If you didn't have an example handy what prompted you to

Get the class name

2009-06-07 Thread Kless
Is there any way of to get the class name to avoid to have that write it? --- class Foo: super(Foo, self) --- * Using Py 2.6.2 -- http://mail.python.org/mailman/listinfo/python-list

can it be shorter?

2009-06-07 Thread tsangpo
I want to ensure that the url ends with a '/', now I have to do thisa like below. url = url + '' if url[-1] == '/' else '/' Is there a better way? -- http://mail.python.org/mailman/listinfo/python-list

Re: The Complexity And Tedium of Software Engineering

2009-06-07 Thread Kenneth Tilton
verec wrote: On 2009-06-05 21:03:33 +0100, Kenneth Tilton said: When progress stops we will have time to polish our systems, not before. Is that an endorsement of mediocrity? No, of General Patton. hth, kt -- http://mail.python.org/mailman/listinfo/python-list

Re: multi-core software

2009-06-07 Thread Raymond Wiker
Roedy Green writes: > On Fri, 5 Jun 2009 18:15:00 + (UTC), Kaz Kylheku > wrote, quoted or indirectly quoted someone who > said : > >>Even for problems where it appears trivial, there can be hidden >>issues, like false cache coherency communication where no actual >>sharing is taking place. O

Re: The Complexity And Tedium of Software Engineering

2009-06-07 Thread verec
On 2009-06-05 21:03:33 +0100, Kenneth Tilton said: When progress stops we will have time to polish our systems, not before. Is that an endorsement of mediocrity? -- JFB -- http://mail.python.org/mailman/listinfo/python-list

openhook

2009-06-07 Thread Gaudha
Can anybody tell me what is meant by 'openhook' ? -- http://mail.python.org/mailman/listinfo/python-list

Re: multi-core software

2009-06-07 Thread Roedy Green
On Fri, 5 Jun 2009 18:15:00 + (UTC), Kaz Kylheku wrote, quoted or indirectly quoted someone who said : >Even for problems where it appears trivial, there can be hidden >issues, like false cache coherency communication where no actual >sharing is taking place. Or locks that appear to have low

Re: multi-core software

2009-06-07 Thread Scott David Daniels
Lew wrote: Scott David Daniels wrote: the nub of the problem is not on the benchmarks. There is something to be said for the good old daays when you looked up the instruction timings that you used in a little document for your machine, and could know the cost of any loop. We are faster now, bu

Re: spammers on pypi

2009-06-07 Thread Scott David Daniels
Lawrence D'Oliveiro wrote: In message , joep wrote: Is there a way to ban spammers from pypi? Yes, but it doesn't work. And if you ever do discover something that _does_ work: (1) You'll have discovered perpetual motion. (2) You'll probably get terribly rich from selling it. (3) You'll

Re: multi-core software

2009-06-07 Thread Jon Harrop
Scott David Daniels wrote: > Lew wrote: >> Scott David Daniels wrote: >>> the nub of the problem is not on the benchmarks. There is something >>> to be said for the good old daays when you looked up the instruction >>> timings that you used in a little document for your machine, and could >>> know

Re: multi-core software

2009-06-07 Thread Jon Harrop
Paul Rubin wrote: > "Jeff M." writes: >> > > Even the lightest weight >> > > user space ("green") threads need a few hundred instructions, >> > > minimum, to amortize the cost of context switching >> There's always a context switch. It's just whether or not you are >> switching in/out a virtua

Re: can it be shorter?

2009-06-07 Thread Paul Rubin
Aaron Brady writes: > url+= { '/': '' }.get( url[ -1 ], '/' ) > > Shorter is always better. url = url.rstrip('/') + '/' -- http://mail.python.org/mailman/listinfo/python-list

Re: multi-core software

2009-06-07 Thread Paul Rubin
"Jeff M." writes: > > > Even the lightest weight > > > user space ("green") threads need a few hundred instructions, minimum, > > > to amortize the cost of context switching > There's always a context switch. It's just whether or not you are > switching in/out a virtual stack and registers for

Re: multi-core software

2009-06-07 Thread Paul Rubin
George Neuner writes: > Even the lightest weight > user space ("green") threads need a few hundred instructions, minimum, > to amortize the cost of context switching. I thought the definition of green threads was that multiplexing them doesn't require context switches. -- http://mail.python.org/

fileinput.input(f,inplace=True,...) preserves perms?

2009-06-07 Thread kj
Does fileinput.input(files, inplace=True, ...) preserve the permissions of the file? (I.e. does it ensure that the new file has the same permissions as the original file?) TIA! kynn -- -- http://mail.python.org/mailman/listinfo/python-list

How to get local copy of docs?

2009-06-07 Thread kj
What's the best way to get a local copy of the documentation at http://docs.python.org? (The goal is to have access to this documentation even when offline.) TIA! kynn -- -- http://mail.python.org/mailman/listinfo/python-list

Python preprosessor

2009-06-07 Thread R. David Murray
Tuomas Vesterinen wrote: > I am developing a Python application as a Python2.x and Python3.0 > version. A common code base would make the work easier. So I thought to > try a preprosessor. GNU cpp handles this kind of code correct: > > > #ifdef python2 > print u'foo', u'bar' > #endif > #ifdef

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread R. David Murray
John Machin wrote: > On Jun 8, 12:13 am, "R. David Murray" wrote: > > higer wrote: > > > My file contains such strings : > > > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > > > > If those bytes are what is in the file (and it sounds like they are), > > then the data in your file is not in UTF8 encoding

Re: pylint naming conventions?

2009-06-07 Thread David Stanek
On Sun, Jun 7, 2009 at 9:23 AM, Esmail wrote: > Ben Finney wrote: >> >> Esmail writes: >> >>> I am confused by pylint's naming conventions, I don't think the are in >>> tune with Python's style recommendations (PEP 8?) >>> >>> Anyone else think this? >> >> It's hard to know, without examples. Can

Re: multi-core software

2009-06-07 Thread Ken T.
On Mon, 08 Jun 2009 02:39:40 +0100, Jon Harrop wrote: > Ken T. wrote: >> On Sun, 07 Jun 2009 11:16:46 -0400, Lew wrote: >>> So the good old days are a matter of degree and self-deception - it >>> was easier to fool ourselves then that we could at least guess timings >>> proportionately if not abso

Re: multi-core software

2009-06-07 Thread Jon Harrop
Arved Sandstrom wrote: > Jon Harrop wrote: >> Arved Sandstrom wrote: >>> Lew wrote: Interesting distinction. Would it be fair to compare concurrent programming to the bricks used to build the parallel program's edifice? >>> Way too much of a fine distinction. While they are in fact diffe

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread higer
On Jun 8, 8:20 am, MRAB wrote: > John Machin wrote: > > On Jun 8, 12:13 am, "R. David Murray" wrote: > >> higer wrote: > >>> My file contains such strings : > >>> \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > >> If those bytes are what is in the file (and it sounds like they are), > >> then the data in

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread higer
On Jun 7, 11:25 pm, John Machin wrote: > On Jun 7, 10:55 pm, higer wrote: > > > My file contains such strings : > > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > > Are you sure? Does that occupy 9 bytes in your file or 36 bytes? > It was saved in a file, so it occupy 36 bytes. If I just use a variabl

Re: Get the class name

2009-06-07 Thread Carl Banks
On Jun 7, 1:14 pm, Kless wrote: > Is there any way of to get the class name to avoid to have that write > it? > > --- > class Foo: >    super(Foo, self) > --- > > * Using Py 2.6.2 If you are using emacs you can use the put the following elisp code in your .emacs file, defi

Re: multi-core software

2009-06-07 Thread Arved Sandstrom
Jon Harrop wrote: Arved Sandstrom wrote: Lew wrote: Interesting distinction. Would it be fair to compare concurrent programming to the bricks used to build the parallel program's edifice? Way too much of a fine distinction. While they are in fact different, the point of concurrent programming

Re: multi-core software

2009-06-07 Thread Jon Harrop
Ken T. wrote: > On Sun, 07 Jun 2009 11:16:46 -0400, Lew wrote: >> So the good old days are a matter of degree and self-deception - it was >> easier to fool ourselves then that we could at least guess timings >> proportionately if not absolutely, but things definitely get more >> unpredictable over

Re: multi-core software

2009-06-07 Thread Dave Angel
Lew wrote: Scott David Daniels wrote: the nub of the problem is not on the benchmarks. There is something to be said for the good old daays when you looked up the instruction timings that you used in a little document for your machine, and could know the cost of any loop. We are faster now, bu

Re: Get the class name

2009-06-07 Thread Robert Kern
On 2009-06-07 15:41, Tuomas Vesterinen wrote: Kless wrote: Is there any way of to get the class name to avoid to have that write it? --- class Foo: super(Foo, self) --- * Using Py 2.6.2 >>> class Foo(object): ... def cls(self): ... return self.__class__ ... >>> Foo

pythoncom and writing file "summary" info on Windows

2009-06-07 Thread mattleftbody
Hello, I was trying to put together a script that would write things like the Author and Title metadata fields of a file under Windows. I got the win32 extensions installed and found a few things that look like they should work, though I'm not getting the result I would expect. Hopefully someone h

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread John Machin
On Jun 8, 10:20 am, MRAB wrote: > John Machin wrote: > > On Jun 8, 12:13 am, "R. David Murray" wrote: > >> higer wrote: > >>> My file contains such strings : > >>> \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > >> If those bytes are what is in the file (and it sounds like they are), > >> then the data i

Re: multi-core software

2009-06-07 Thread Patricia Shanahan
Jon Harrop wrote: ... Historically, concurrency has been of general interest on single core machines in the context of operating systems and IO and has become more important recently due to the ubiquity of web programming. Parallelism was once only important to computational scientists programmin

Re: Keeping console window open

2009-06-07 Thread Dave Angel
Fencer wrote: Scott David Daniels wrote: To be a trifle more explicit, turn: ... if __name__ == '__main__': main() into: ... if __name__ == '__main__': try: main() except Exception, why: print 'Failed:', why

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread MRAB
John Machin wrote: On Jun 8, 12:13 am, "R. David Murray" wrote: higer wrote: My file contains such strings : \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a If those bytes are what is in the file (and it sounds like they are), then the data in your file is not in UTF8 encoding, it is in ASCII encoded a

Re: multi-core software

2009-06-07 Thread Jon Harrop
Lew wrote: > Jon Harrop wrote: >> I agree entirely but my statements were about parallelism and not >> concurrency. Parallel and concurrent programming have wildly different >> characteristics and solutions. I don't believe shared mutable state is >> overly problematic in the context of parallelism

Re: multi-core software

2009-06-07 Thread Jon Harrop
Arved Sandstrom wrote: > Lew wrote: >> Interesting distinction. Would it be fair to compare concurrent >> programming to the bricks used to build the parallel program's edifice? > > Way too much of a fine distinction. While they are in fact different, > the point of concurrent programming is to s

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread John Machin
On Jun 8, 12:13 am, "R. David Murray" wrote: > higer wrote: > > My file contains such strings : > > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > > If those bytes are what is in the file (and it sounds like they are), > then the data in your file is not in UTF8 encoding, it is in ASCII > encoded as hexi

Re: Making the case for repeat

2009-06-07 Thread Raymond Hettinger
[pataphor] > So here is my proposed suggestion for a once and for all reconciliation > of various functions in itertools that can not stand on their own and > keep a straight face. Interesting phraseology ;-) Enticing and yet fallacious in its presumption of known and accepted usability problems.

Re: Python preprosessor

2009-06-07 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tuomas Vesterinen wrote: > I am intensively using 2to3.py. So I have 2 codebase: one in py2 and the > other in py3. The expectation would be that you only maintain the py2 code and automatically generate the py3 code on demand using 2to3. It is possi

Re: multi-core software

2009-06-07 Thread Arved Sandstrom
Lew wrote: Jon Harrop wrote: I agree entirely but my statements were about parallelism and not concurrency. Parallel and concurrent programming have wildly different characteristics and solutions. I don't believe shared mutable state is overly problematic in the context of parallelism. Indeed, I

Re: can it be shorter?

2009-06-07 Thread Brian
Since extra slashes at the end of a URL are ignored, that means I win! url+='/' On Sun, Jun 7, 2009 at 4:45 PM, Aaron Brady wrote: > On Jun 6, 8:07 am, "tsangpo" wrote: > > I want to ensure that the url ends with a '/', now I have to do thisa > like > > below. > > url = url + '' if url[-1] ==

Re: can it be shorter?

2009-06-07 Thread Aaron Brady
On Jun 6, 8:07 am, "tsangpo" wrote: > I want to ensure that the url ends with a '/', now I have to do thisa like > below. > url = url + '' if url[-1] == '/' else '/' > > Is there a better way? url+= { '/': '' }.get( url[ -1 ], '/' ) Shorter is always better. -- http://mail.python.org/mailman/li

Re: unladen swallow: python and llvm

2009-06-07 Thread Brian
On Fri, Jun 5, 2009 at 3:29 AM, Nick Craig-Wood wrote: > > > It is an interesting idea for a number of reasons, the main one as far > as I'm concerned is that it is more of a port of CPython to a new > architecture than a complete re-invention of python (like PyPy / > IronPython / jython) so stan

Re: unladen swallow: python and llvm

2009-06-07 Thread bearophileHUGS
Paul Rubin: >IMHO the main problem with the Unladen Swallow approach is that it would >surprise me if CPython really spends that much of its time interpreting byte >code.< Note that Py3 already has a way to speed up byte code interpretation where compiled by GCC or Intel compiler (it's a very o

Re: multi-core software

2009-06-07 Thread Ken T.
On Sun, 07 Jun 2009 11:16:46 -0400, Lew wrote: > So the good old days are a matter of degree and self-deception - it was > easier to fool ourselves then that we could at least guess timings > proportionately if not absolutely, but things definitely get more > unpredictable over evolution. As I re

Re: Properties for several keywords

2009-06-07 Thread Scott David Daniels
Kless wrote: On 7 jun, 11:45, Kless wrote: I've to write properties for several keywords with the same code, it only changes the name of each property: ... Is possible to simplify it? Please, is there any solution for this problem? Read up on property. It is the core of your answer. That

Re: multi-core software

2009-06-07 Thread Lew
Jon Harrop wrote: I agree entirely but my statements were about parallelism and not concurrency. Parallel and concurrent programming have wildly different characteristics and solutions. I don't believe shared mutable state is overly problematic in the context of parallelism. Indeed, I think it is

Re: multi-core software

2009-06-07 Thread Jon Harrop
Lew wrote: > As Dr. Jon pointed out upthread, one can write decent code with mutable > shared > state. It is also true that mutable state presents a lot of problems - > potential problems, ones that can be solved, but not ones that can be > solved > thoughtlessly. On the flip side, one can write

Re: pypi compatible software

2009-06-07 Thread Martin v. Löwis
> - is code behind pypi.python.org available and why i can't find some > up-to-date official document or howto for private pypi repository > (maybe it exists but i just can't find it)? The code is at https://svn.python.org/packages/ Instructions for installing it are at http://wiki.python.org/m

Re: multi-core software

2009-06-07 Thread Jon Harrop
Jeff M. wrote: > On Jun 7, 3:19 pm, Arved Sandstrom wrote: >> Jon Harrop wrote: >> > Arved Sandstrom wrote: >> >> Jon Harrop wrote: >> >>> I see no problem with mutable shared state. >> >> In which case, Jon, you're in a small minority. >> >> > No. Most programmers still care about performance and

Re: multi-core software

2009-06-07 Thread Lew
Jon Harrop wrote: I see no problem with mutable shared state. In which case, Jon, you're in a small minority. Patricia Shanahan wrote: In my opinion, shared mutable state has a lot of problems. It is also sometimes the best design for performance reasons. As Dr. Jon pointed out upthread, on

Re: multi-core software

2009-06-07 Thread Jeff M.
On Jun 7, 3:19 pm, Arved Sandstrom wrote: > Jon Harrop wrote: > > Arved Sandstrom wrote: > >> Jon Harrop wrote: > >>> I see no problem with mutable shared state. > >> In which case, Jon, you're in a small minority. > > > No. Most programmers still care about performance and performance means > > m

Re: unladen swallow: python and llvm

2009-06-07 Thread Paul Rubin
bearophileh...@lycos.com writes: > What I like of Unladen swallow is that it's a very practical approach, > very different in style from ShedSkin and PyPy (and it's more > ambitious than Psyco). I also like Unladen swallow because they are > the few people that have the boldness to do something to

Re: How to get local copy of docs?

2009-06-07 Thread kj
In TonyM writes: >http://docs.python.org/download.html Perfect. Thanks! kynn -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Properties for several keywords

2009-06-07 Thread Kless
On 7 jun, 11:45, Kless wrote: > I've to write properties for several keywords with the same code, it > only changes the name of each property: > > - > @property >    def foo(self): >       return self._foo > > @foo.setter >    def foo(self, txt): >       self._foo = sel

Re: multi-core software

2009-06-07 Thread Jon Harrop
Joshua Cranmer wrote: > Jon Harrop wrote: >> No. Most programmers still care about performance and performance means >> mutable state. > > [ Citation needed ]. > > Most programmers I've met could care less about performance. Then they have no need for parallelism in the first place. -- Dr Jon

Re: multi-core software

2009-06-07 Thread Jon Harrop
Arved Sandstrom wrote: > Jon Harrop wrote: >> Arved Sandstrom wrote: >>> Jon Harrop wrote: I see no problem with mutable shared state. >>> >>> In which case, Jon, you're in a small minority. >> >> No. Most programmers still care about performance and performance means >> mutable state. > > Q

Re: The pysync library - Looking for the code, but all download links are broken

2009-06-07 Thread Søren - Peng - Pedersen
I think what you are looking for can be found at: http://www.google.com/codesearch/p?hl=en#RncWxgazS6A/pysync-2.24/test/testdata.py&q=pysync%20package:%22http://minkirri.apana.org.au/~abo/projects/pysync/arc/pysync-2.24.tar.bz2%22%20lang:python or http://shortlink.dk/58664133 I am not affiliated

Re: multi-core software

2009-06-07 Thread Patricia Shanahan
Jon Harrop wrote: Arved Sandstrom wrote: Jon Harrop wrote: I see no problem with mutable shared state. In which case, Jon, you're in a small minority. No. Most programmers still care about performance and performance means mutable state. I don't see why that would affect whether one think

pypi compatible software

2009-06-07 Thread Aljosa Mohorovic
i've been searching for a recommended way to setup private pypi repository and i've found several options: - PloneSoftwareCenter - http://code.google.com/p/pypione/ - http://pypi.python.org/pypi/haufe.eggserver - http://www.chrisarndt.de/projects/eggbasket/ - http://pypi.python.org/pypi/ClueRelease

Re: Get the class name

2009-06-07 Thread Tuomas Vesterinen
Kless wrote: Is there any way of to get the class name to avoid to have that write it? --- class Foo: super(Foo, self) --- * Using Py 2.6.2 >>> class Foo(object): ... def cls(self): ... return self.__class__ ... >>> Foo().cls() -- http://mail.python.or

Re: unladen swallow: python and llvm

2009-06-07 Thread bearophileHUGS
Luis M. González: > it seems they intend to do "upfront > compilation". How? Unladen swallow developers want to try everything (but black magic and necromancy) to increase the speed of Cpython. So they will try to compile up-front if/where they can (for example most regular expressions are known a

Re: Iterating Over Dictionary From Arbitrary Location

2009-06-07 Thread bearophileHUGS
Aahz: > See various "ordered dictionary" implementations > for ideas on coding this. But be careful to not confuse ordered dictionaries with sorted ones :-) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get local copy of docs?

2009-06-07 Thread TonyM
On Jun 7, 1:11 pm, kj wrote: > What's the best way to get a local copy of the documentation > athttp://docs.python.org? (The goal is to have access to this > documentation even when offline.) > > TIA! > > kynn > -- http://docs.python.org/download.html -- http://mail.python.org/mailman/listinfo/

Re: multi-core software

2009-06-07 Thread Arved Sandstrom
Jon Harrop wrote: Arved Sandstrom wrote: Jon Harrop wrote: I see no problem with mutable shared state. In which case, Jon, you're in a small minority. No. Most programmers still care about performance and performance means mutable state. Quite apart from performance and mutable state, I be

Re: multi-core software

2009-06-07 Thread Joshua Cranmer
Jon Harrop wrote: No. Most programmers still care about performance and performance means mutable state. [ Citation needed ]. Most programmers I've met could care less about performance. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth --

403 error for python webpage

2009-06-07 Thread Daniel
I created a page with a ".py" extension but the browser does not like it. Here is what I did: I edited httpd.conf file and added the line: AddHandler cgi-script .cgi .py Then I stopped and restarted apache. Next I created a hello world file as on this page: http://deron.meranda.us/python/webserving

Re: How to get local copy of docs?

2009-06-07 Thread Tomasz Zieliński
On 7 Cze, 19:11, kj wrote: > What's the best way to get a local copy of the documentation > athttp://docs.python.org? (The goal is to have access to this > documentation even when offline.) They have also CHM version (I'm not not sure where I got it from, but I think it was Windows installer).

Re: multi-core software

2009-06-07 Thread Jon Harrop
Arved Sandstrom wrote: > Jon Harrop wrote: >> I see no problem with mutable shared state. > > In which case, Jon, you're in a small minority. No. Most programmers still care about performance and performance means mutable state. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsu

Re: unladen swallow: python and llvm

2009-06-07 Thread Nick Craig-Wood
Neuruss wrote: > ok, let me see if I got it: > The Python vm is written in c, and generates its own bitecodes which > in turn get translated to machine code (one at a time). > Unladen Swallow aims to replace this vm by one compiled with the llvm > compiler, which I guess will generate differe

Re: Python preprosessor

2009-06-07 Thread Tuomas Vesterinen
Peter Otten wrote: Tuomas Vesterinen wrote: I am developing a Python application as a Python2.x and Python3.0 version. A common code base would make the work easier. So I thought to try a preprosessor. GNU cpp handles this kind of code correct: Any other suggestions? http://docs.python.org

Re: unladen swallow: python and llvm

2009-06-07 Thread MRAB
Neuruss wrote: On 5 jun, 06:29, Nick Craig-Wood wrote: Luis M González wrote: I am very excited by this project (as well as by pypy) and I read all their plan, which looks quite practical and impressive. But I must confess that I can't understand why LLVM is so great for python and why

Re: Is reduce() foldl() or foldr()?

2009-06-07 Thread Paul Rubin
Steven D'Aprano writes: > Calling all functional programming fans... is Python's built-in reduce() > a left-fold or a right-fold? It's a left fold. > but other people say it's a right-fold, e.g.: > "... there is a `foldr` in Haskell that just works like `reduce()`" That is correct in the sens

Re: pyc-files contains absolute paths, is this a bug ?

2009-06-07 Thread Steven D'Aprano
On Sun, 07 Jun 2009 18:16:26 +0200, Stef Mientki wrote: > hello, > > AFAIK I read that pyc files can be transferred to other systems. I > finally got a windows executable working through py2exe, but still have > some troubles, moving the directory around. Sounds like a py2exe problem, not a Pyth

Re: Python preprosessor

2009-06-07 Thread Peter Otten
Tuomas Vesterinen wrote: > I am developing a Python application as a Python2.x and Python3.0 > version. A common code base would make the work easier. So I thought to > try a preprosessor. GNU cpp handles this kind of code correct: > Any other suggestions? http://docs.python.org/dev/3.1/library/

Re: Iterating Over Dictionary From Arbitrary Location

2009-06-07 Thread Aahz
In article , akindo wrote: > >So, it seems I want the best of both worlds: specific indexing using >my own IDs/keys (not just by list element location), sorting and the >ability to start iterating from a specific location. I am trying to >prevent having to scan through a list from the begin

Python preprosessor

2009-06-07 Thread Tuomas Vesterinen
I am developing a Python application as a Python2.x and Python3.0 version. A common code base would make the work easier. So I thought to try a preprosessor. GNU cpp handles this kind of code correct: #ifdef python2 print u'foo', u'bar' #endif #ifdef python3 print('foo', 'bar') #endif result

pyc-files contains absolute paths, is this a bug ?

2009-06-07 Thread Stef Mientki
hello, AFAIK I read that pyc files can be transferred to other systems. I finally got a windows executable working through py2exe, but still have some troubles, moving the directory around. I use Python 2.5.2. I use py2exe to make a distro I can unpack the distro, on a clean computer, anywhere w

Re: unladen swallow: python and llvm

2009-06-07 Thread Neuruss
On 5 jun, 06:29, Nick Craig-Wood wrote: > Luis M  González wrote: > > >  I am very excited by this project (as well as by pypy) and I read all > >  their plan, which looks quite practical and impressive. > >  But I must confess that I can't understand why LLVM is so great for > >  python and why

Re: multi-core software

2009-06-07 Thread Arved Sandstrom
Jon Harrop wrote: Roedy Green wrote: On Fri, 5 Jun 2009 18:15:00 + (UTC), Kaz Kylheku wrote, quoted or indirectly quoted someone who said : Even for problems where it appears trivial, there can be hidden issues, like false cache coherency communication where no actual sharing is taking pla

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread John Machin
On Jun 7, 10:55 pm, higer wrote: > My file contains such strings : > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a Are you sure? Does that occupy 9 bytes in your file or 36 bytes? > > I want to read the content of this file and transfer it to the > corresponding gbk code,a kind of Chinese character encod

Re: multi-core software

2009-06-07 Thread Lew
Scott David Daniels wrote: the nub of the problem is not on the benchmarks. There is something to be said for the good old daays when you looked up the instruction timings that you used in a little document for your machine, and could know the cost of any loop. We are faster now, but part of th

Re: multi-core software

2009-06-07 Thread Jon Harrop
George Neuner wrote: > On Fri, 05 Jun 2009 16:26:37 -0700, Roedy Green > wrote: >>On Fri, 5 Jun 2009 18:15:00 + (UTC), Kaz Kylheku >> wrote, quoted or indirectly quoted someone who >>said : >>>Even for problems where it appears trivial, there can be hidden >>>issues, like false cache coherency

Re: multi-core software

2009-06-07 Thread Jon Harrop
Roedy Green wrote: > On Fri, 5 Jun 2009 18:15:00 + (UTC), Kaz Kylheku > wrote, quoted or indirectly quoted someone who > said : >>Even for problems where it appears trivial, there can be hidden >>issues, like false cache coherency communication where no actual >>sharing is taking place. Or loc

Re: Is reduce() foldl() or foldr()?

2009-06-07 Thread Piet van Oostrum
> Tim Northover (TN) escribió: >TN> Steven D'Aprano writes: >>> Calling all functional programming fans... is Python's built-in reduce() >>> a left-fold or a right-fold? >TN> I get: > reduce(lambda a, b: a/b, [1.0, 2.0, 3.0]) >TN> 0.1 >TN> which looks like a left fold

Re: multi-core software

2009-06-07 Thread Jeff M.
On Jun 7, 1:56 am, Paul Rubin wrote: > "Jeff M." writes: > > > > Even the lightest weight > > > > user space ("green") threads need a few hundred instructions, minimum, > > > > to amortize the cost of context switching > > There's always a context switch. It's ju

how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread R. David Murray
higer wrote: > My file contains such strings : > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a If those bytes are what is in the file (and it sounds like they are), then the data in your file is not in UTF8 encoding, it is in ASCII encoded as hexidecimal escape codes. > I want to read the content of this

Re: Keeping console window open

2009-06-07 Thread Fencer
Scott David Daniels wrote: To be a trifle more explicit, turn: ... if __name__ == '__main__': main() into: ... if __name__ == '__main__': try: main() except Exception, why: print 'Failed:', why import sys,

The pysync library - Looking for the code, but all download links are broken

2009-06-07 Thread jpersson
Hi, >From the description the library pysync seems to be a perfect match for some of the things I would like to accomplish in my own project. The problem is that all the download links seems to be broken, so I cannot download the code. http://freshmeat.net/projects/pysync/ I've also tried to mai

Re: Keeping console window open

2009-06-07 Thread Scott David Daniels
Tomasz Zieliński wrote: On 7 Cze, 14:49, Fencer wrote: My question is how can I trap errors encountered by the interpreter (if that is the right way to put it) in order to keep the console window open so one has a chance to see the error message? Interpreter errors are same beasts as exceptio

Re: pylint naming conventions?

2009-06-07 Thread Esmail
Ben Finney wrote: Esmail writes: I am confused by pylint's naming conventions, I don't think the are in tune with Python's style recommendations (PEP 8?) Anyone else think this? It's hard to know, without examples. Can you give some output of pylint that you think doesn't agree with PEP 8?

Re: Keeping console window open

2009-06-07 Thread Can Xue
2009/6/7 Fencer > Anyway, I wrote a few lines of code and when I first tried to run it by > double-clicking the .py-file the console window still disappeared right > away. So, in order to see what was happening, I ran it from a shell and it > turned out to be a missing import. My question is how

Re: Keeping console window open

2009-06-07 Thread Tomasz Zieliński
On 7 Cze, 14:49, Fencer wrote: > My question is how can I trap > errors encountered by the interpreter (if that is the right way to put > it) in order to keep the console window open so one has a chance to see > the error message? > Interpreter errors are same beasts as exceptions, so you can try

how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread higer
My file contains such strings : \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a I want to read the content of this file and transfer it to the corresponding gbk code,a kind of Chinese character encode style. Everytime I was trying to transfer, it will output the same thing no matter which method was used. I

Keeping console window open

2009-06-07 Thread Fencer
Hello, I need to write a simple utility program that will be used under Windows. I want to write the utility in python and it will be run by double-clicking the the .py-file. I put a raw_input('Press enter to exit) at the end so the console window wouldn't just disappear when the program is fi

Re: Is reduce() foldl() or foldr()?

2009-06-07 Thread Scott David Daniels
Steven D'Aprano wrote: Calling all functional programming fans... is Python's built-in reduce() a left-fold or a right-fold? ... So which is correct? Or is it that different people have different definitions of foldl() and foldr()? Just test. Floating point addition is not associative, so: >

Re: Is reduce() foldl() or foldr()?

2009-06-07 Thread Peter Otten
Steven D'Aprano wrote: > Calling all functional programming fans... is Python's built-in reduce() > a left-fold or a right-fold? > > Wikipedia says it's a left-fold: > > http://en.wikipedia.org/wiki/Fold_(higher-order_function) Wikipedia is correct: >>> from __future__ import division >>> (1/(

  1   2   >