Re: turtle dump

2009-07-16 Thread Peter Otten
Terry Reedy wrote: > Terry Reedy wrote: > >>> $ file tmp.ps >>> tmp.ps: PostScript document text conforming DSC level 3.0, type EPS >>> >>> Try changing the file extension from .ps to .eps. >> >> I will. Thank you. > > I tried it. Unfortunately, OOo does not open it correctly. It just > display

Re: Einstein summation notation (was: question of style)

2009-07-16 Thread Chris Rebert
On Thu, Jul 16, 2009 at 11:13 PM, koranthala wrote: >> That test was designed to treat None as a boolean False, without >> noticing that numeric 0 is also treated as False and could make the >> test do the wrong thing.  This is an extremely common type of error. > > Actually, I felt that 0 not bein

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Gabriel Rossetti
Piet van Oostrum wrote: Gabriel Rossetti (GR) wrote: GR> Hello everyone, GR> I am using threading.Condition.wait(timeout) and was surprised to see that GR> there is no return value nor an exception when wait() is used w/ a timeout. GR> How am I supposed to know if it was notif

Re: Einstein summation notation (was: question of style)

2009-07-16 Thread koranthala
> That test was designed to treat None as a boolean False, without > noticing that numeric 0 is also treated as False and could make the > test do the wrong thing. This is an extremely common type of error. Actually, I felt that 0 not being considered False would be a better option. I had lot of

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Gabriel Rossetti
Maxim Khitrov wrote: On Thu, Jul 16, 2009 at 5:00 PM, Carl Banks wrote: On Jul 16, 8:12 am, Gabriel Rossetti wrote: Hello everyone, I am using threading.Condition.wait(timeout) and was surprised to see that there is no return value nor an exception when wait() is used w/ a timeout. Ho

Try... except....Try again?

2009-07-16 Thread Xavier Ho
I have a simple class that generates prime numbers, using memorisation and iteration to generate the next prime number. In the class, I have defined a function that gives, say, the 5th prime number. Or the 1000th, it's still very fast. But the code isn't what I really like. def nPrime(self, n

invoke method on many instances

2009-07-16 Thread Alan G Isaac
As a recurrent situation, I need to invoke the same method on many instances. Speed matters, but the solution should be pure Python. Is the following convenience function a reasonable approach? def apply2(itr, methodname, *args, **kwargs): f = operator.methodcaller(methodname, *args, **kwarg

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Aahz
In article , Gabriel Rossetti wrote: > >I am using threading.Condition.wait(timeout) and was surprised to see >that there is no return value nor an exception when wait() is used w/ a >timeout. How am I supposed to know if it was notified or if it timed out? What are you trying to do? Maybe yo

error when compiling source on linux

2009-07-16 Thread aj
when I try to compile Python 2.6 from source code on ubuntu, I get the message /usr/bin/ld: cannot open output file python: Is a directory collect2: ld returned 1 exit status make: *** [python] Error 1 PLEASE HELP! -- http://mail.python.org/mailman/listinfo/python-list

Re: Persistent variable in subprocess using multiprocessing?

2009-07-16 Thread Wai Yip
I think Diez' example show this work automatically in Unix. In my case I use Windows. I use the multiprocessing.Array to share data in shared memory. multiprocessing.Array has a limitation that it can only reference simple C data types, not Python objects though. Wai Yip Tung -- http://mail.pytho

ctype performance benchmark

2009-07-16 Thread auror...@gmail.com
I have done some performance benchmarking for Python's ctypes library. I think you may find it interesting. I am planning to use ctypes as an alternative to writing C extension module for performance enhancement. Therefore my use case is slight different from the typical use case for accessing exis

Re: ImportError: No module named _functools

2009-07-16 Thread Aahz
In article , Tony Lay wrote: >On Jul 16, 10:14=A0am, a...@pythoncraft.com (Aahz) wrote: >> In article <45228cf4-0b37-4c52-bf6f-d7bd124b0...@l32g2000vbp.googlegroups= >.com>, >> Tony =A0Lay =A0 wrote: >>> >>>Traceback (most recent call last): >>> =A0File "/usr/local/bin/meld", line 35, in >>> =A

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
Well, you were write: unintentionally I removed strip(). But the problem does not ends here: I get this error now: File "./temp.py", line 488, in main() File "./temp.py", line 475, in main for line in sys.stdin: File "/usr/local/lib/python3.1/codecs.py", line 300, in decode (re

ANN: gnupg v0.2.0 released

2009-07-16 Thread Vinay Sajip
A new version of the Python module which wraps GnuPG has been released. What Changed? = The module was refactored slightly to support Python 3.0. The current version now passes all tests on Windows (Python 2.4, 2.5) and Ubuntu (Python 2.4, 2.5, 2.6 and 3.0). What Does It Do?

Re: Override a method but inherit the docstring

2009-07-16 Thread Ben Finney
Paul McGuire writes: > Two ideas come to mind, the decorator way and the metaclass way. I am > not a guru at either, but these two examples work: I think the decorator idea is most attractive to me, since it can be applied per method. > # the decorator way > def inherit_docstring_from(cls): >

ANN: psyco V2

2009-07-16 Thread Christian Tismer
Announcing Psyco V2 source release -- This is the long awaited announcement of Psyco V2. Psyco V2 is a continuation of the well-known psyco project, which was called finished and was dis-continued by its author Armin Rigo in 2005, in favor of the PyPy project. Th

Re: Override a method but inherit the docstring

2009-07-16 Thread Paul McGuire
On Jul 16, 8:01 pm, Ben Finney wrote: > Howdy all, > > The following is a common idiom:: > >     class FooGonk(object): >         def frobnicate(self): >             """ Frobnicate this gonk. """ >             basic_implementation(self.wobble) > >     class BarGonk(FooGonk): >         def frobnica

Re: Override a method but inherit the docstring

2009-07-16 Thread Rhodri James
On Fri, 17 Jul 2009 02:01:49 +0100, Ben Finney wrote: Howdy all, The following is a common idiom:: class FooGonk(object): def frobnicate(self): """ Frobnicate this gonk. """ basic_implementation(self.wobble) class BarGonk(FooGonk): def frobni

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread Nobody
On Thu, 16 Jul 2009 15:43:37 -0700, akhil1988 wrote: >> In Python 3 you can't decode strings because they are Unicode strings >> and it doesn't make sense to decode a Unicode string. You can only >> decode encoded things which are byte strings. So you are mixing up byte >> strings and Unicode stri

Re: Override a method but inherit the docstring

2009-07-16 Thread Maxim Khitrov
On Thu, Jul 16, 2009 at 9:13 PM, Jean-Paul Calderone wrote: > On Fri, 17 Jul 2009 11:01:49 +1000, Ben Finney > wrote: >> >> Howdy all, >> >> The following is a common idiom:: >> >>   class FooGonk(object): >>       def frobnicate(self): >>           """ Frobnicate this gonk. """ >>           basic

Einstein summation notation (was: question of style)

2009-07-16 Thread Erik Max Francis
Albert van der Horst wrote: Einstein introduced the summation convention for indices that are used twice. Leaving out summation signs is absolutely hideous, but it has saved generations of physicists of loosing track (and their minds.) There is a joke among mathematicians that if Einstein hadn'

Re: missing 'xor' Boolean operator

2009-07-16 Thread Nobody
On Thu, 16 Jul 2009 14:59:22 -0700, Emile van Sebille wrote: If the question was "Why is there no 'or' operator ?", would "because A or B <=> not(not A and not B)" be a proper answer ? >>> Note that in Python A or B is in fact not equivalent to not(not A and >>> not B). >> >> Ah, but it

Re: Override a method but inherit the docstring

2009-07-16 Thread Jean-Paul Calderone
On Fri, 17 Jul 2009 11:01:49 +1000, Ben Finney wrote: Howdy all, The following is a common idiom:: class FooGonk(object): def frobnicate(self): """ Frobnicate this gonk. """ basic_implementation(self.wobble) class BarGonk(FooGonk): def frobnicate(sel

Re: TypeError: unbound method

2009-07-16 Thread Chris Rebert
On Thu, Jul 16, 2009 at 5:57 PM, Ronn Ross wrote: > Hello all, > > Created a python file that has a class and three methods. When I jump into > interactive mode I import like so: > > from import > > Now when I try to use a method from the class: > > var1 = class.method() > > It give me this error

Override a method but inherit the docstring

2009-07-16 Thread Ben Finney
Howdy all, The following is a common idiom:: class FooGonk(object): def frobnicate(self): """ Frobnicate this gonk. """ basic_implementation(self.wobble) class BarGonk(FooGonk): def frobnicate(self): special_implementation(self.warble)

TypeError: unbound method

2009-07-16 Thread Ronn Ross
Hello all, Created a python file that has a class and three methods. When I jump into interactive mode I import like so: from import Now when I try to use a method from the class: var1 = class.method() It give me this error: TypeError: unbound method must be called with instance as first a

Re: turtle dump

2009-07-16 Thread Terry Reedy
Terry Reedy wrote: $ file tmp.ps tmp.ps: PostScript document text conforming DSC level 3.0, type EPS Try changing the file extension from .ps to .eps. I will. Thank you. I tried it. Unfortunately, OOo does not open it correctly. It just displays the first three lines of metadate - Title, C

Re: turtle dump

2009-07-16 Thread alex23
> >> Help on method postscript: > >> postscript(self, *args, **kw) method of turtle.ScrolledCanvas instance > >> is spectacularly useless. > > This is from interactive help. The help in iPython says the same, but also mentions that it's a dynamically generated function, so it may not be picking up

Re: Clarity vs. code reuse/generality

2009-07-16 Thread Albert van der Horst
In article , Lie Ryan wrote: >Steven D'Aprano wrote: >> On Tue, 07 Jul 2009 05:13:28 +, Lie Ryan wrote: >> >>> When people are fighting over things like `sense`, although sense may >>> not be strictly wrong dictionary-wise, it smells of something burning... >> >> That would be my patience. >>

Re: Clarity vs. code reuse/generality

2009-07-16 Thread Albert van der Horst
In article , kj wrote: > > >I'm will be teaching a programming class to novices, and I've run >into a clear conflict between two of the principles I'd like to >teach: code clarity vs. code reuse. I'd love your opinion about >it. > > >This seemed straightforward enough, until I realized that, to

Re: question of style

2009-07-16 Thread Albert van der Horst
In article <7x8wj2agma@ruckus.brouhaha.com>, Paul Rubin wrote: >Steven D'Aprano writes: >> > but I don't accept that "somethingness" >> > vs. "nothingness" is the same distinction as truth vs falsehood. >> >> It's the distinction used by Python since the dawn of

Re: question of style

2009-07-16 Thread Albert van der Horst
In article <7x8wj4uxnb@ruckus.brouhaha.com>, Paul Rubin wrote: > >Anyway, Python's overloading of bool(...) is yet another misfeature >and although it's convenient, the "explicit is better than implicit" >principle indicates to avoid that sort of trick. Well, tr

Visualization of Python Class Hierarchy

2009-07-16 Thread lh
I would like to automatically generate this for my program. I am running python in an eclipse context (pydev). I am not familiar with the best current tools. Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not enforce four space indentations in version 3.x?

2009-07-16 Thread Ben Finney
Inky 788 writes: > On Jul 10, 7:35 pm, Ben Finney wrote: > > Yes. That's a “should” and not a “must”, even though PEP 8 says it > > with a simple imperative:: > > > >     Use 4 spaces per indentation level. > > That actually sounds pretty weird. "Don't do {foo}. Really, I mean > *really* don't

Re: does python have a generic object pool like commons-pool in Java

2009-07-16 Thread Graham Dumpleton
On Jul 16, 3:05 pm, John Nagle wrote: > alex23 wrote: > > On Jul 16, 2:03 pm, John Nagle wrote: > >>      "fcgi" is an option for this sort of thing.  With "mod_fcgi" installed > >> in Apache, and "fcgi.py" used to manage the Python side of the problem, you > >> can have semi-persistent programs

Re: turtle dump

2009-07-16 Thread Terry Reedy
Peter Otten wrote: Terry Reedy wrote: Help on method postscript: postscript(self, *args, **kw) method of turtle.ScrolledCanvas instance is spectacularly useless. This is from interactive help. http://docs.python.org/library/turtle.html#turtle.getcanvas That method, following your lead,

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
Then, how should I do it? I read a byte string from sys.stdin which needs to converted to unicode string for further processing. I cannot just remove the decode statement and proceed? This is it what it looks like: for line in sys.stdin: line = line.decode('utf-8').strip() if line == '':

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Carl Banks
On Jul 16, 2:22 pm, Maxim Khitrov wrote: > On Thu, Jul 16, 2009 at 5:00 PM, Carl Banks wrote: > > On Jul 16, 8:12 am, Gabriel Rossetti > > wrote: > >> Hello everyone, > > >> I am using threading.Condition.wait(timeout) and was surprised to see > >> that there is no return value nor an exception w

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread Piet van Oostrum
> akhil1988 (a) wrote: >a> ok! >a> I got the indentation errors fixed. Bu I get another error: >a> Traceback (most recent call last): >a> File "./temp.py", line 484, in >a> main() >a> File "./temp.py", line 476, in main >a> line.decode('utf-8').strip() >a> AttributeError: 'str'

Python 3 xmlrpc client HTTPS problem

2009-07-16 Thread Leo List
I have just built and installed version 3.1 and all's good, but when I try to connect to a server via HTTPS I get the following: File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1029, in __call__ return self.__send(self.__name, args) File "/usr/local/lib/python3.1/xmlrpc/client.py",

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Piet van Oostrum
> Gabriel Rossetti (GR) wrote: >GR> Hello everyone, >GR> I am using threading.Condition.wait(timeout) and was surprised to see that >GR> there is no return value nor an exception when wait() is used w/ a timeout. >GR> How am I supposed to know if it was notified or if it timed out? Normally

Re: missing 'xor' Boolean operator

2009-07-16 Thread Emile van Sebille
On 7/16/2009 1:29 PM Nobody said... On Wed, 15 Jul 2009 18:14:10 +0200, Hrvoje Niksic wrote: If the question was "Why is there no 'or' operator ?", would "because A or B <=> not(not A and not B)" be a proper answer ? Note that in Python A or B is in fact not equivalent to not(not A and not B).

Re: turtle dump

2009-07-16 Thread Peter Otten
Terry Reedy wrote: > Michiel Overtoom wrote: >> >> I got success with the following code (python 2.6.2): >> >> import turtle >> turtle.reset() >> for i in range(4): >>turtle.forward(50) >>turtle.right(90) >> can=turtle.getscreen().getcanvas() >> can.postscript(file="tmp.ps") > > Is raw

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Maxim Khitrov
On Thu, Jul 16, 2009 at 5:00 PM, Carl Banks wrote: > On Jul 16, 8:12 am, Gabriel Rossetti > wrote: >> Hello everyone, >> >> I am using threading.Condition.wait(timeout) and was surprised to see >> that there is no return value nor an exception when wait() is used w/ a >> timeout. How am I supposed

Re: Why aren't OrderedDicts comparable with < etc?

2009-07-16 Thread Nobody
On Thu, 16 Jul 2009 03:59:47 -0700, Mark wrote: >> > Or maybe not. If OrderedDicts are sequences as well as mappings, then we >> > should be able to sort them. And that seems a bit much even for me. >> One thing that I've just noticed is that you can use <, <=, >=, and > >> with sets: >> It seem

Re: interactive fiction in Python?

2009-07-16 Thread Terry Reedy
J Kenneth King wrote: George Oliver writes: hi, I'm just curious who might be working on interactive fiction modules in the style of Inform or TADS for Python. I've seen a few threads on this list [1] (among many that mention IF tangentially), and there are old projects like PUB and PAWS. Ther

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Carl Banks
On Jul 16, 8:12 am, Gabriel Rossetti wrote: > Hello everyone, > > I am using threading.Condition.wait(timeout) and was surprised to see > that there is no return value nor an exception when wait() is used w/ a > timeout. How am I supposed to know if it was notified or if it timed out? That's a go

Re: This is a mess...

2009-07-16 Thread Terry Reedy
Nick wrote: this is the new oop version, its pretty messy currently, and i do understand it is a simple routine, but i'm using it as an exercise to learn oop python... You neglected to specify Python version. first the (current) traceback: [:~/python]$ python oop_covariance.py b2ar_all_test

file write IOError Invalid argument

2009-07-16 Thread Robert Robert
Hello All, I am trying to write a binary string to file on a windows network share. I get an IOError. I've read that it is because the file size is too large. I did a type( binaryString) and saw that it was type "str". So I loop through it one by one element and use f.write to write to file, and

Re: turtle dump

2009-07-16 Thread Terry Reedy
Michiel Overtoom wrote: I got success with the following code (python 2.6.2): import turtle turtle.reset() for i in range(4): turtle.forward(50) turtle.right(90) can=turtle.getscreen().getcanvas() can.postscript(file="tmp.ps") Is raw postscript (.ps) the only thing tk can write from can

Re: This is a mess...

2009-07-16 Thread Nick Craig-Wood
Nick wrote: > this is the new oop version, its pretty messy currently, and i do > understand it is a simple routine, but i'm using it as an exercise to > learn oop python... > > first the (current) traceback: > [:~/python]$ python oop_covariance.py b2ar_all_test b2ar_all_test > > > Trac

Re: missing 'xor' Boolean operator

2009-07-16 Thread Nobody
On Wed, 15 Jul 2009 18:14:10 +0200, Hrvoje Niksic wrote: >> If the question was "Why is there no 'or' operator ?", would "because >> A or B <=> not(not A and not B)" be a proper answer ? > > Note that in Python A or B is in fact not equivalent to not(not A and > not B). Ah, but it *is* "equivale

Re: missing 'xor' Boolean operator

2009-07-16 Thread Nobody
On Thu, 16 Jul 2009 11:06:54 +0200, Jean-Michel Pichavant wrote: >>> So if I resume: >>> - not 'foo' => False >>> - 'foo' or 'foo' => 'foo' >>> >>> I may be missing something, but honestly, Guido must have smoked some >>> heavy stuff to write such logic, has he ? >> >> Several languages (e.g. Lis

Re: list of all possible values

2009-07-16 Thread Mensanator
On Jul 16, 11:49 am, "Andreas Tawn" wrote: > > > Certainly possible with list comprehensions. > > > a = "abc" > > [(x, y) for x in a for y in a] > > > [('a', 'a'), ('a', 'b'), ('a', 'c'), ('b', 'a'), ('b', 'b'), ('b', > 'c'), > > > ('c', 'a'), ('c', 'b'), ('c', 'c')] > > > > But I like b

Re: This is a mess...

2009-07-16 Thread Piet van Oostrum
> Nick (N) wrote: >N> this is the new oop version, its pretty messy currently, and i do >N> understand it is a simple routine, but i'm using it as an exercise to >N> learn oop python... >N> first the (current) traceback: >N> [:~/python]$ python oop_covariance.py b2ar_all_test b2ar_all_test

Re: ImportError: No module named _functools

2009-07-16 Thread Tony Lay
On Jul 16, 10:14 am, a...@pythoncraft.com (Aahz) wrote: > In article > <45228cf4-0b37-4c52-bf6f-d7bd124b0...@l32g2000vbp.googlegroups.com>, > Tony  Lay   wrote: > > > > >Traceback (most recent call last): > >  File "/usr/local/bin/meld", line 35, in > >    import gettext > >  File "/usr/local/lib

Re: missing 'xor' Boolean operator

2009-07-16 Thread Luis Alberto Zarrabeitia Gomez
Quoting Jean-Michel Pichavant : > Emile van Sebille wrote: > > On 7/16/2009 7:04 AM Unknown said... > >> On 2009-07-16, Emile van Sebille wrote: > >>> daysInAdvance = int(inputVar) or 25 > >> > >> I don't get it. That doesn't work right when inputVar == "0". > >> > > Aah, but you didn't get to

Re: ImportError: No module named _functools

2009-07-16 Thread Tony Lay
On Jul 16, 10:14 am, a...@pythoncraft.com (Aahz) wrote: > In article > <45228cf4-0b37-4c52-bf6f-d7bd124b0...@l32g2000vbp.googlegroups.com>, > Tony  Lay   wrote: > > > > >Traceback (most recent call last): > >  File "/usr/local/bin/meld", line 35, in > >    import gettext > >  File "/usr/local/lib

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
ok! I got the indentation errors fixed. Bu I get another error: Traceback (most recent call last): File "./temp.py", line 484, in main() File "./temp.py", line 476, in main line.decode('utf-8').strip() AttributeError: 'str' object has no attribute 'decode' I am using Python3.1 Than

Re: Ann: Google releases Python-based open-source NX server

2009-07-16 Thread J Kenneth King
Robert Kern writes: > On 2009-07-16 09:51, J Kenneth King wrote: >> jkn writes: >> >>> Google quietly releases open-source NX server ...written in Python, >>> apparently >>> >>> >> Google_quietly_releases_open_source_NX_server?taxonomyId=88> >>>

Re: Passing python list from C to python

2009-07-16 Thread Aahz
In article <0afc5c4d-1af5-4d0e-9442-26b51b12e...@m11g2000yqh.googlegroups.com>, hartley wrote: > >If you had loosened up on the sarcasm I would probably have read what >you wrote more thoroughly instead of just skimming through it. Thanks >for the help, but you should seriously consider doing som

Re: Persistent variable in subprocess using multiprocessing?

2009-07-16 Thread Piet van Oostrum
> mheavner (m) wrote: >m> I realize that the Queue would be the best way of doing this, however >m> that involves transferring the huge amount of data for each call - my >m> hope was to transfer it once and have it remain in memory for the >m> subprocess across run() calls. Which huge amount

URLError errno and strerror not set

2009-07-16 Thread 1x7y2z9
python 2.5.2 errno, strerror and message do not appear to be set in the following two cases (at least). Is this to be expected? (as an aside, arg[0] is set) # case 1 > print exception, exception.errno, exception.strerror, exception.message == '' None None True # case 2 > print exception, exce

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
Hi, Thanks all for the replies. I am working on a cluster of 15 nodes and I have now installed python 3.1 on all of them. I tried installing python2.6 but there was some make error. So, I do not want to give more time in installing 2.4 and rather use 3.1 but for that I need to convert my 2.4 co

Re: Why aren't OrderedDicts comparable with < etc?

2009-07-16 Thread Terry Reedy
Mark wrote: On 16 July, 10:21, Piet van Oostrum wrote: But why should the order be as if the OrderedDict was a list of tuples. A dict can be considered as a mapping and then you might want to treat either the key or the value as contravariant (the key I guess). So there is ambiguity. Why woul

Re: Why not enforce four space indentations in version 3.x?

2009-07-16 Thread Carl Banks
On Jul 16, 6:32 am, Inky 788 wrote: > On Jul 10, 7:35 pm, Ben Finney wrote: > > > walterbyrd writes: > > > I believe Guido himself has said that all indentions should be four > > > spaces - no tabs. > > > Yes. That's a “should” and not a “must”, even though PEP 8 says it > > with a simple impera

Re: Why not enforce four space indentations in version 3.x?

2009-07-16 Thread Tim Chase
However, they are a single logical level of indentation -- I come down fairly solidly on the "tabs" side of the "tabs vs. spaces" argument. My bet is that the problem is this: some people like to format their code in ways that don't work well when you're using tabs. For example, they might want

Re: Ann: Google releases Python-based open-source NX server

2009-07-16 Thread Robert Kern
On 2009-07-16 09:51, J Kenneth King wrote: jkn writes: Google quietly releases open-source NX server ...written in Python, apparently Neatx can be downloaded from Google's code repos

Re: Ann: Google releases Python-based open-source NX server

2009-07-16 Thread Emile van Sebille
On 7/16/2009 10:59 AM jkn said... Personally, I don't follow PEP8 either. Note: PEP-8 gives 'coding conventions for the Python code **comprising the standard library in the main Python distribution**' (my emphasis). My coding conventions are similar to, but not exactly the same as, PEP-8. Mine

Re: Ann: Google releases Python-based open-source NX server

2009-07-16 Thread jkn
On Jul 16, 3:51 pm, J Kenneth King wrote: > It's pretty cool, but not PEP8! Probably because they just bought the > source off of another smaller proprietary project.  Makes me sad seeing > Google, proud supporter of all things Python, release non-PEP8 code. Personally, I don't follow PEP8 eithe

Re: missing 'xor' Boolean operator

2009-07-16 Thread Jean-Michel Pichavant
Emile van Sebille wrote: On 7/16/2009 7:04 AM Unknown said... On 2009-07-16, Emile van Sebille wrote: daysInAdvance = int(inputVar) or 25 I don't get it. That doesn't work right when inputVar == "0". Aah, but you didn't get to define right. :) For that particular example 0 is not a vali

Re: Why not enforce four space indentations in version 3.x?

2009-07-16 Thread Inky 788
On Jul 16, 10:18 am, Tim Chase wrote: > > I realize that a small portion of the community likes the tabs. > > They're sold on the tabs. They like the tabs. But tabs are an archaic > > holdover from an era when typewriters had physical tabstops on them. > > However, they are a single logical level

Re: Persistent variable in subprocess using multiprocessing?

2009-07-16 Thread mheavner
I realize that the Queue would be the best way of doing this, however that involves transferring the huge amount of data for each call - my hope was to transfer it once and have it remain in memory for the subprocess across run() calls. On Jul 16, 1:18 pm, Piet van Oostrum wrote: > > mheavner

Re: Persistent variable in subprocess using multiprocessing?

2009-07-16 Thread Piet van Oostrum
> mheavner (m) wrote: >m> 'The process' refers to the subprocess. I could do as you say, load >m> the data structure each time, but the problem is that takes a >m> considerable amount of time compared to the the actual computation >m> with the data it contains. I'm using these processes withi

Re: Python Equivalent for dd & fold

2009-07-16 Thread MRAB
Michiel Overtoom wrote: seldan24 wrote: I know that Emile suggested that I can slice out the substrings rather than do the gradual trimming of the string variable as is being done by moving around the length. An excellent idea. def fold(s,chunklength): offset=0 while offset More Pyt

Re: Python Equivalent for dd & fold

2009-07-16 Thread MRAB
seldan24 wrote: On Jul 15, 1:48 pm, Emile van Sebille wrote: On 7/15/2009 10:23 AM MRAB said... On Jul 15, 12:47 pm, Michiel Overtoom wrote: seldan24 wrote: what can I use as the equivalent for the Unix 'fold' command? def fold(s,len): while s: print s[:len] s=s[len

RE: list of all possible values

2009-07-16 Thread Andreas Tawn
> > Certainly possible with list comprehensions. > > > a = "abc" > [(x, y) for x in a for y in a] > > [('a', 'a'), ('a', 'b'), ('a', 'c'), ('b', 'a'), ('b', 'b'), ('b', 'c'), > > ('c', 'a'), ('c', 'b'), ('c', 'c')] > > > > But I like bearophile's version better. > > > > Andreas, > > Tha

Re: Python Equivalent for dd & fold

2009-07-16 Thread ryles
On Jul 15, 1:14 pm, seldan24 wrote: > On Jul 15, 12:47 pm, Michiel Overtoom wrote: > > > > > seldan24 wrote: > > > what can I use as the equivalent for the Unix 'fold' command? > > > def fold(s,len): > >      while s: > >          print s[:len] > >          s=s[len:] > > > s="A very long string i

Re: missing 'xor' Boolean operator

2009-07-16 Thread Emile van Sebille
On 7/16/2009 7:04 AM Unknown said... On 2009-07-16, Emile van Sebille wrote: daysInAdvance = int(inputVar) or 25 I don't get it. That doesn't work right when inputVar == "0". Aah, but you didn't get to define right. :) For that particular example 0 is not a valid response. Emile -- ht

Re: list of all possible values

2009-07-16 Thread David Gibb
> Certainly possible with list comprehensions. > a = "abc" [(x, y) for x in a for y in a] > [('a', 'a'), ('a', 'b'), ('a', 'c'), ('b', 'a'), ('b', 'b'), ('b', 'c'), > ('c', 'a'), ('c', 'b'), ('c', 'c')] > > But I like bearophile's version better. > Andreas, Thanks, but I think you were

Re: Python Equivalent for dd & fold

2009-07-16 Thread pdpi
On Jul 16, 3:12 pm, seldan24 wrote: > On Jul 15, 1:48 pm, Emile van Sebille wrote: > > > > > > > On 7/15/2009 10:23 AM MRAB said... > > > >> On Jul 15, 12:47 pm, Michiel Overtoom wrote: > > >>> seldan24 wrote: > > what can I use as the equivalent for the Unix 'fold' command? > > >>> def fol

Re: How to check if any item from a list of strings is in a big string?

2009-07-16 Thread Pablo Torres N.
On Thu, Jul 9, 2009 at 22:07, Steven D'Aprano wrote: > On Thu, 09 Jul 2009 18:36:05 -0700, inkhorn wrote: > >> def list_items_in_string(list_items, string): >>     for item in list_items: >>         if item in string: >>             return True >>     return False > ... >> Any ideas how to make tha

Re: Python Equivalent for dd & fold

2009-07-16 Thread Casey Webster
On Jul 16, 10:12 am, seldan24 wrote: > On Jul 15, 1:48 pm, Emile van Sebille wrote: > > > > > On 7/15/2009 10:23 AM MRAB said... > > > >> On Jul 15, 12:47 pm, Michiel Overtoom wrote: > > >>> seldan24 wrote: > > what can I use as the equivalent for the Unix 'fold' command? > > >>> def fold(s

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread John Machin
On Jul 16, 9:04 pm, akhil1988 wrote: > Please click reply on the post and then read this reply in the editor. > Actually, some sequences have been replaced to their graphical form when > this post is published. So the python code is being displayed, what actually > it is not. What editor? I guess

Re: Python Equivalent for dd & fold

2009-07-16 Thread Michiel Overtoom
seldan24 wrote: I know that Emile suggested that I can slice out the substrings rather than do the gradual trimming of the string variable as is being done by moving around the length. An excellent idea. def fold(s,chunklength): offset=0 while offsethttp://www.catb.org/~esr/halloween

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread Max Erickson
akhil1988 wrote: > > akhil1988 wrote: >> >> I have switched to python 3.1 , but now I am getting some syntax >> errors in the code: >> >> File "./customWikiExtractor.py", line 81 >> __char_entities = {' ' :u'\u00A0', '¡' >> :u'\u00A1', >> '¢':u'\u00A2', >>

no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Gabriel Rossetti
Hello everyone, I am using threading.Condition.wait(timeout) and was surprised to see that there is no return value nor an exception when wait() is used w/ a timeout. How am I supposed to know if it was notified or if it timed out? cheers, Gabriel -- http://mail.python.org/mailman/listinfo/py

Re: Ann: Google releases Python-based open-source NX server

2009-07-16 Thread J Kenneth King
jkn writes: > Google quietly releases open-source NX server ...written in Python, > apparently > > Google_quietly_releases_open_source_NX_server?taxonomyId=88> > > Neatx can be downloaded from Google's code repository: > >

Re: interactive fiction in Python?

2009-07-16 Thread J Kenneth King
George Oliver writes: > hi, I'm just curious who might be working on interactive fiction > modules in the style of Inform or TADS for Python. I've seen a few > threads on this list [1] (among many that mention IF tangentially), > and there are old projects like PUB and PAWS. There are some newer

IFL 2009: Third Call for Papers

2009-07-16 Thread IFL 2009
Call for Papers IFL 2009Seton Hall UniversitySOUTH ORANGE, NJ, USAhttp://tltc.shu.edu/blogs/projects/IFL2009/* NEW *Registration is now opened! Register at: http://tltc.shu.edu/blogs/projects/IFL2009/registration.htmlInvited Speaker:    Benjamin C. Pierce    University of Pennsylvania    Ta

Re: Memory leak involving traceback objects

2009-07-16 Thread Aahz
In article , Rotem wrote: > >I'm debugging a nasty memory leak in a framework written in Python >(v2.6.2). >After much digging around I found that the entire object group that is >leaking is held by a frame object which is subsequently held by a >traceback object. > >Traversing the get_referrers(

Re: Passing python list from C to python

2009-07-16 Thread John Machin
On Jul 16, 11:13 pm, hartley wrote: > /* the first telling */ > (...) > /* the second telling */ > (...) > /* the third telling */ > > - > If you had loosened up on the sarcasm That wasn't sarcasm, it was an attempt at humourous watering-down the expression of exasperation at continued ignoring o

Re: This is a mess...

2009-07-16 Thread Nick
this is the new oop version, its pretty messy currently, and i do understand it is a simple routine, but i'm using it as an exercise to learn oop python... first the (current) traceback: [:~/python]$ python oop_covariance.py b2ar_all_test b2ar_all_test Traceback (most recent call last): File

Re: Why not enforce four space indentations in version 3.x?

2009-07-16 Thread Tim Chase
I realize that a small portion of the community likes the tabs. They're sold on the tabs. They like the tabs. But tabs are an archaic holdover from an era when typewriters had physical tabstops on them. However, they are a single logical level of indentation -- I come down fairly solidly on the

Re: ImportError: No module named _functools

2009-07-16 Thread Aahz
In article <45228cf4-0b37-4c52-bf6f-d7bd124b0...@l32g2000vbp.googlegroups.com>, Tony Lay wrote: > >Traceback (most recent call last): > File "/usr/local/bin/meld", line 35, in >import gettext > File "/usr/local/lib/python2.6/gettext.py", line 49, in >import locale, copy, os, re, stru

Re: Python Equivalent for dd & fold

2009-07-16 Thread seldan24
On Jul 15, 1:48 pm, Emile van Sebille wrote: > On 7/15/2009 10:23 AM MRAB said... > > >> On Jul 15, 12:47 pm, Michiel Overtoom wrote: > >>> seldan24 wrote: > what can I use as the equivalent for the Unix 'fold' command? > >>> def fold(s,len): > >>>      while s: > >>>          print s[:len]

This is a mess...

2009-07-16 Thread Nick
I've been coding python for about a week now, and i'm trying to make an object oriented version of a program i just wrote. in this post is the original program. the next post will include the new programs and the traceback. i'm sure there are many underlying problems, but have been stuck on this

Re: How to search this newsgroup by a python script.

2009-07-16 Thread Grant Edwards
On 2009-07-16, Chris Rebert wrote: > On Thu, Jul 16, 2009 at 2:12 AM, Helmut > Jarausch wrote: >> Hi, >> >> I haven't found anything with Google's group search, so let me >> ask it (again?). >> >> How can I search this newsgroup from within a Python script. >> (Perhaps by searching Google Groups o

Re: missing 'xor' Boolean operator

2009-07-16 Thread Grant Edwards
On 2009-07-16, Emile van Sebille wrote: > On 7/16/2009 2:06 AM Jean-Michel Pichavant said... >> Ok then, why "or" does not return True, if the first element is >> considered True ? Why returning the element itself. Any reason for that >> ? Because it's confusing, maybe people used to that logic

Re: using timers to force an execution time

2009-07-16 Thread superpollo
Nick Craig-Wood wrote: > ... import signal, os, time ... importing os is useless of course... -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >