Re: Spreadsheet-style dependency tracking

2010-10-19 Thread Carl Banks
On Oct 19, 8:59 pm, Lawrence D'Oliveiro wrote: > In message > , Carl > > Banks wrote: > > On Oct 18, 4:15 pm, Lawrence D'Oliveiro > > wrote: > > >> In message > >> <42d82f8a-4ee6-44a7-914d-86dfc21f1...@a36g2000yqc.googlegroups.com>, > >> Fuzzyman wrote: > > >>> Allowing calculations to complete e

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-19 Thread Stefan Behnel
Dun Peal, 20.10.2010 02:07: On Mon, Oct 18, 2010 at 1:41 AM, Stefan Behnel wrote: Or, a bit shorter, using Cython 0.13: def only_allowed_characters(list strings): cdef unicode s return any((c< 31 or c> 127) for s in strings for c in s) Very cool, this

Re: merge list of tuples with list

2010-10-19 Thread James Mills
On Wed, Oct 20, 2010 at 1:33 PM, Daniel Wagner wrote: > Any more efficient ways or suggestions are still welcome! Did you not see Paul Rubin's solution: >>> [x+(y,) for x,y in zip(a,b)] [(1, 2, 3, 7), (4, 5, 6, 8)] I think this is much nicer and probably more efficient. cheers James -- -- J

Re: Spreadsheet-style dependency tracking

2010-10-19 Thread Lawrence D'Oliveiro
In message , Carl Banks wrote: > On Oct 18, 4:15 pm, Lawrence D'Oliveiro > wrote: > >> In message >> <42d82f8a-4ee6-44a7-914d-86dfc21f1...@a36g2000yqc.googlegroups.com>, >> Fuzzyman wrote: >> >>> Allowing calculations to complete even in the presence of cycles can be >>> very useful. >> >> But

Re: merge list of tuples with list

2010-10-19 Thread Daniel Wagner
SOLVED! I just found it out > I'm searching for a nice way to merge a list of > tuples with another tuple or list. Short example: > a = [(1,2,3), (4,5,6)] > b = (7,8) > > After the merging I would like to have an output like: > a = [(1,2,3,7), (4,5,6)] The following code solves the problem: >

Re: merge list of tuples with list

2010-10-19 Thread Daniel Wagner
I used the following code to add a single fixed value to both tuples. But this is still not what I want... >>>a = [(1,2,3), (4,5,6)] >>>b = 1 >>>a = map(tuple, map(lambda x: x + [1], map(list, a))) >>>a [(1, 2, 3, 1), (4, 5, 6, 1)] What I need is: >>>a = [(1,2,3), (4,5,6)] >>>b = (7,8) >>> a = COD

Re: merge list of tuples with list

2010-10-19 Thread MRAB
On 20/10/2010 02:26, Paul Rubin wrote: Daniel Wagner writes: My short question: I'm searching for a nice way to merge a list of tuples with another tuple or list. Short example: a = [(1,2,3), (4,5,6)] b = (7,8) ... the output should look like: a = [(1,2,3,7), (4,5,6,8)] That is not really in

Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 3:33 PM, Hrvoje Niksic wrote: > Jed Smith writes: > >>>     echo (-echo) >>>                 Echo back (do not echo back) every character typed. >> >> I'm going to guess that the percent sign in your prompt indicates that >> you're using zsh(1).  With my minimally-customiz

Re: Code smells: too many parameters, too many attributes (was: pylint -- should I just ignore it sometimes?)

2010-10-19 Thread Seebs
On 2010-10-20, Ben Finney wrote: > It's a code smell. Many discrete attributes is a sign that the design > can be improved by combining related attributes into a complex type. Ahh. I think that makes sense. In this case, I don't think it's worth it, but I can see why it would be in some cases.

Re: merge list of tuples with list

2010-10-19 Thread Paul Rubin
Daniel Wagner writes: >> > My short question: I'm searching for a nice way to merge a list of >> > tuples with another tuple or list. Short example: >> > a = [(1,2,3), (4,5,6)] >> > b = (7,8) ... > the output should look like: > a = [(1,2,3,7), (4,5,6,8)] That is not really in the spirit of tuple

Re: merge list of tuples with list

2010-10-19 Thread Daniel Wagner
On Oct 19, 8:35 pm, James Mills wrote: > On Wed, Oct 20, 2010 at 10:16 AM, Daniel Wagner > > wrote: > > My short question: I'm searching for a nice way to merge a list of > > tuples with another tuple or list. Short example: > > a = [(1,2,3), (4,5,6)] > > b = (7,8) > > > After the merging I would

Code smells: too many parameters, too many attributes (was: pylint -- should I just ignore it sometimes?)

2010-10-19 Thread Ben Finney
Seebs writes: > I'm pretty much mystified by a claim that something with seven > instance attributes is "too complicated". It's a code smell. Many discrete attributes is a sign that the design can be improved by combining related attributes into a complex type. It's pretty much the same smell,

Re: OO and game design questions

2010-10-19 Thread Martin Gregorie
On Tue, 19 Oct 2010 19:49:20 -0400, Dave Angel wrote: > Thanks, that is what I was trying to say. In the same sense that > emptying a list makes it quite small, if it's a general purpose object, > you just want to remove all the attributes. > I think a 'place' (to generalise it) is quite a small

Re: get python bit version as in (32 or 64)

2010-10-19 Thread Ned Deily
In article , Vincent Davis wrote: > On Tue, Oct 19, 2010 at 3:55 PM, Philip Semanchuk > wrote: > > On Oct 19, 2010, at 5:38 PM, Hexamorph wrote: > >> On 19.10.2010 23:18, Vincent Davis wrote: > >>> How do I get the bit version of the installed python. In my case, osx > >>> python2.7 binary ins

Re: Print to an IPP printer (pkipplib?)

2010-10-19 Thread Дамјан Георгиевски
> I've found the module pkipplib which seems to work well for things > like > interrogating an IPP (CUPS) server. But is there a way to send a > print job to an IPP print queue? [and no, the local system knows > nothing about > the print architecture so popenlp is not an option]. I just want

Re: merge list of tuples with list

2010-10-19 Thread James Mills
On Wed, Oct 20, 2010 at 10:16 AM, Daniel Wagner wrote: > My short question: I'm searching for a nice way to merge a list of > tuples with another tuple or list. Short example: > a = [(1,2,3), (4,5,6)] > b = (7,8) > > After the merging I would like to have an output like: > a = [(1,2,3,7), (4,5,6)]

merge list of tuples with list

2010-10-19 Thread Daniel Wagner
Hello Everyone, I'm new in this group and I hope it is ok to directly ask a question. My short question: I'm searching for a nice way to merge a list of tuples with another tuple or list. Short example: a = [(1,2,3), (4,5,6)] b = (7,8) After the merging I would like to have an output like: a = [

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-19 Thread Dun Peal
On Mon, Oct 18, 2010 at 1:41 AM, Stefan Behnel wrote: > Or, a bit shorter, using Cython 0.13: > >    def only_allowed_characters(list strings): >        cdef unicode s >        return any((c < 31 or c > 127) >                   for s in strings for c in s) Very cool, this caused me to look up the

Re: OO and game design questions

2010-10-19 Thread Dave Angel
On 2:59 PM, Terry Reedy wrote: On 10/19/2010 1:46 PM, Ian Kelly wrote: On Tue, Oct 19, 2010 at 5:37 AM, Dave Angel mailto:da...@ieee.org>> wrote: Simply replace room B with a "destroyed room" object. That can be quite small, and you only need one, regardless of how many rooms are

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Alexander Kapps wrote: > The general idea is, that modules, classes, methods, and functions > should be small so they are better reusable, manageable and > understandable. Makes sense. > If you have a huge class or function with many > attributes or local variables, it's often

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Ben Finney wrote: > Tools like pylint are far more useful if every message they emit is > something that you must deal with, rather than ignore every time you see > it. That way, it's feasible to get the output to no messages at all, and > have a defensible reason for every disabled

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Martin P. Hellwig wrote: > Speaking without context here, so take it with as much salt as required > ;-), it is not that unusual. However there are some things to consider, > for example are all these attributes related to each other? If so > wouldn't it be more pythonic to have

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Alexander Kapps
On 20.10.2010 00:36, Seebs wrote: On 2010-10-19, Martin P. Hellwig wrote: Well, as with all styles IMHO, if there is a _good_ reason to break it, then by all means do, but you might want to consider putting in a comment why you did that and add the #pylint: disable-msg= on that line. If that is

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Martin P. Hellwig
On 10/19/10 23:36, Seebs wrote: It seems like a very odd measure of complexity; is it really that unusual for objects to have more than seven meaningful attributes? Speaking without context here, so take it with as much salt as required ;-), it is not that unusual. However there are some thing

Re: get python bit version as in (32 or 64)

2010-10-19 Thread Vincent Davis
On Tue, Oct 19, 2010 at 3:55 PM, Philip Semanchuk wrote: > > On Oct 19, 2010, at 5:38 PM, Hexamorph wrote: > >> On 19.10.2010 23:18, Vincent Davis wrote: >>> How do I get the bit version of the installed python. In my case, osx >>> python2.7 binary installed. I know it runs 64 bt as I can see it i

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Ben Finney
Seebs writes: > So, I'm messing around with pylint. Quite a lot of what it says > is quite reasonable, makes sense to me, and all that. > > There's a few exceptions. While the exceptions will no doubt lead to fascinating discussions, I'll offer a somewhat related piece of advice: If you're goi

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Martin P. Hellwig wrote: > Well, as with all styles IMHO, if there is a _good_ reason to break it, > then by all means do, but you might want to consider putting in a > comment why you did that and add the #pylint: disable-msg= > on that line. If that is overkill, why not just co

Re: Starting Python in XP Pro

2010-10-19 Thread Dave Angel
On 10/19/2010 3:06 PM, Grant Andrew wrote: 1. Okay, I can open the interpreter and do math. If only I needed the answer to 6*7 I'd be great. But, to your point, Python is installed and working. 2. When I went to the shortcut and hit properties, the path was Target: C:\Python26\Lib\idlelib\i

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Terry Reedy
On 10/19/2010 5:43 PM, Seebs wrote: That reminds me, though. Speaking of deprecation, I have: from string import Template (see PEP 292 or so?), and pylint says "Uses of a deprecated module 'string'", but I don't know of a way to get Template except by doing that. A buggy PyLint is pas

Re: Starting Python in XP Pro

2010-10-19 Thread Grant Andrew
Success - I worked with a friend who is Python-fluent to diagnose this issue and it turns out that in addition to the PATH variable, there were TCL and TK variables that were pointing toward an old install of Python. With these references pointed toward the correct folders in the current install,

Re: Unicode questions

2010-10-19 Thread Terry Reedy
On 10/19/2010 4:31 PM, Tobiah wrote: There is no such thing as "plain Unicode representation". The closest thing would be an abstract sequence of Unicode codepoints (ala Python's `unicode` type), but this is way too abstract to be used for sharing/interchange, because storing anything in a file o

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Martin P. Hellwig
On 10/19/10 20:57, Seebs wrote: So, I'm messing around with pylint. Quite a lot of what it says is quite reasonable, makes sense to me, and all that. There's a few exceptions. Well, as with all styles IMHO, if there is a _good_ reason to break it, then by all means do, but you might want to c

Re: Getting returncode of a command executed with Popen through xterm

2010-10-19 Thread AmFreak
Am 19.10.2010, 10:10 Uhr, schrieb Diez B. Roggisch : amfr...@web.de writes: Hi, i have a program that have to execute linux commands. I do it like this: retcode = Popen(["xterm", "-e", command],stdin=PIPE, stdout=PIPE, stderr=PIPE) I have to use xterm because some commands need further inpu

Re: get python bit version as in (32 or 64)

2010-10-19 Thread Philip Semanchuk
On Oct 19, 2010, at 5:38 PM, Hexamorph wrote: > On 19.10.2010 23:18, Vincent Davis wrote: >> How do I get the bit version of the installed python. In my case, osx >> python2.7 binary installed. I know it runs 64 bt as I can see it in >> activity monitor. but how do I ask python? >> sys.version >>

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Terry Reedy
On 10/19/2010 3:57 PM, Seebs wrote: So, I'm messing around with pylint. Quite a lot of what it says is quite reasonable, makes sense to me, and all that. There's a few exceptions. ... So am I going to be laughed out of the room if I just let a class have eight instance attributes, or use a sh

Re: Reading Outlook .msg file using Python

2010-10-19 Thread John Henry
On Oct 19, 2:46 pm, John Henry wrote: > On Oct 17, 4:45 am, Tim Golden wrote: > > > > > On 17/10/2010 6:39 AM, John Henry wrote: > > > > On Oct 12, 10:31 am, Tim Golden  wrote: > > >> On 12/10/2010 4:59 PM, John Henry wrote: > > > >>> According to: > > > >>>http://support.microsoft.com/kb/813745

Re: Reading Outlook .msg file using Python

2010-10-19 Thread John Henry
On Oct 17, 4:45 am, Tim Golden wrote: > On 17/10/2010 6:39 AM, John Henry wrote: > > > > > On Oct 12, 10:31 am, Tim Golden  wrote: > >> On 12/10/2010 4:59 PM, John Henry wrote: > > >>> According to: > > >>>http://support.microsoft.com/kb/813745 > > >>> I need to reset my Outlook registry keys.  Un

Re: Reading Outlook .msg file using Python

2010-10-19 Thread John Henry
On Oct 17, 4:45 am, Tim Golden wrote: > On 17/10/2010 6:39 AM, John Henry wrote: > > > > > On Oct 12, 10:31 am, Tim Golden  wrote: > >> On 12/10/2010 4:59 PM, John Henry wrote: > > >>> According to: > > >>>http://support.microsoft.com/kb/813745 > > >>> I need to reset my Outlook registry keys.  Un

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Shawn Milochik wrote: > Just to be pedantic (or maybe even helpful), the use of the comma > after the exception is deprecated in favor of 'as.' Not in code that has to run on older Pythons. I'm pretty sure I have to work with everything from 2.4 to 2.6 or so. That reminds me, tho

Re: get python bit version as in (32 or 64)

2010-10-19 Thread Vincent Davis
On Tue, Oct 19, 2010 at 3:29 PM, Philip Semanchuk wrote: > > On Oct 19, 2010, at 5:18 PM, Vincent Davis wrote: > >> How do I get the bit version of the installed python. In my case, osx >> python2.7 binary installed. I know it runs 64 bt as I can see it in >> activity monitor. but how do I ask pyt

Re: OO and game design questions

2010-10-19 Thread Terry Reedy
On 10/19/2010 1:46 PM, Ian Kelly wrote: On Tue, Oct 19, 2010 at 5:37 AM, Dave Angel mailto:da...@ieee.org>> wrote: On 2:59 PM, dex wrote: Using strong references, I have to remove room B from list of rooms, and also remove door to room B, as it holds reference to room B.

Re: get python bit version as in (32 or 64)

2010-10-19 Thread Hexamorph
On 19.10.2010 23:18, Vincent Davis wrote: How do I get the bit version of the installed python. In my case, osx python2.7 binary installed. I know it runs 64 bt as I can see it in activity monitor. but how do I ask python? sys.version '2.7 (r27:82508, Jul 3 2010, 21:12:11) \n[GCC 4.0.1 (Apple In

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
On 2010-10-19, Steven D'Aprano wrote: > On Tue, 19 Oct 2010 19:57:36 +, Seebs wrote: >> One: I am a big, big, fan of idiomatic short names where appropriate. >> For instance: >> catch , e: > That would be except, not catch. Er, yeah, that. > Well, that name is 98 characters, which mea

Re: pyqt4 Table Widget deleting c/c++ object

2010-10-19 Thread David Boddie
On Monday 18 October 2010 23:26, Andrew wrote: > I have two issues dealing with the table widget, though they may be > interconnected. I'm not sure. Both delete the cell widgets off of my > table but leave the rows, and then when I have the table update, it > complains the c++ object has been dele

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Shawn Milochik
Just to be pedantic (or maybe even helpful), the use of the comma after the exception is deprecated in favor of 'as.' So: except ValueError as ex: not: except ValueError, ex: I don't know how far back in Python versions this syntax reaches, but if yours supports it then it's probably a good id

Re: get python bit version as in (32 or 64)

2010-10-19 Thread Philip Semanchuk
On Oct 19, 2010, at 5:18 PM, Vincent Davis wrote: > How do I get the bit version of the installed python. In my case, osx > python2.7 binary installed. I know it runs 64 bt as I can see it in > activity monitor. but how do I ask python? > sys.version > '2.7 (r27:82508, Jul 3 2010, 21:12:11) \n[G

get python bit version as in (32 or 64)

2010-10-19 Thread Vincent Davis
How do I get the bit version of the installed python. In my case, osx python2.7 binary installed. I know it runs 64 bt as I can see it in activity monitor. but how do I ask python? sys.version '2.7 (r27:82508, Jul 3 2010, 21:12:11) \n[GCC 4.0.1 (Apple Inc. build 5493)]' -- Thanks Vincent Davis -

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Alexander Kapps
On 19.10.2010 21:57, Seebs wrote: So, I'm messing around with pylint. Quite a lot of what it says is quite reasonable, makes sense to me, and all that. There's a few exceptions. One: I am a big, big, fan of idiomatic short names where appropriate. For instance: catch, e: I don't want

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Steven D'Aprano
On Tue, 19 Oct 2010 19:57:36 +, Seebs wrote: > So, I'm messing around with pylint. Quite a lot of what it says is > quite reasonable, makes sense to me, and all that. > > There's a few exceptions. > > One: I am a big, big, fan of idiomatic short names where appropriate. > For instance: >

Re: Unicode questions

2010-10-19 Thread Chris Rebert
On Tue, Oct 19, 2010 at 1:31 PM, Tobiah wrote: >> There is no such thing as "plain Unicode representation". The closest >> thing would be an abstract sequence of Unicode codepoints (ala Python's >> `unicode` type), but this is way too abstract to be used for >> sharing/interchange, because storing

Re: Unicode questions

2010-10-19 Thread Petite Abeille
On Oct 19, 2010, at 10:31 PM, Tobiah wrote: > So why so many encoding schemes? http://en.wikipedia.org/wiki/Space-time_tradeoff -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode questions

2010-10-19 Thread Tobiah
> There is no such thing as "plain Unicode representation". The closest > thing would be an abstract sequence of Unicode codepoints (ala Python's > `unicode` type), but this is way too abstract to be used for > sharing/interchange, because storing anything in a file or sending it > over a network u

Re: Unicode questions

2010-10-19 Thread Chris Rebert
On Tue, Oct 19, 2010 at 12:02 PM, Tobiah wrote: > I've been reading about the Unicode today. > I'm only vaguely understanding what it is > and how it works. Petite Abeille already pointed to Joel's excellent primer on the subject; I can only second their endorsement of his article. > Please corr

Re: Starting Python in XP Pro

2010-10-19 Thread Sridhar Ratnakumar
Hi Grant, Typing the following opens IDLE (albeit after a short delay; the command will immediately return regardless) for me: C:\> C:\Python26\lib\idlelib\idle.bat IDLE is also installed in the Start Menu for ActivePython. You need at least ActivePython 2.6.6.15 or 2.7.0.2 for this to work.

pylint -- should I just ignore it sometimes?

2010-10-19 Thread Seebs
So, I'm messing around with pylint. Quite a lot of what it says is quite reasonable, makes sense to me, and all that. There's a few exceptions. One: I am a big, big, fan of idiomatic short names where appropriate. For instance: catch , e: I don't want a long, verbose, name -- "e" is abo

Re: Unicode questions

2010-10-19 Thread Hrvoje Niksic
Tobiah writes: > would be shared? Why can't we just say "unicode is unicode" > and just share files the way ASCII users do. Just have a huge > ASCII style table that everyone sticks to. I'm not sure that I understand you correctly, but UCS-2 and UCS-4 encodings are that kind of thing. Many pe

Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Hrvoje Niksic
Jed Smith writes: >> echo (-echo) >> Echo back (do not echo back) every character typed. > > I'm going to guess that the percent sign in your prompt indicates that > you're using zsh(1). With my minimally-customized zsh, the echo > option is reset every time the prompt is dis

Re: Unicode questions

2010-10-19 Thread Petite Abeille
On Oct 19, 2010, at 9:02 PM, Tobiah wrote: > Please enlighten my vague and probably ill-formed conception of this whole > thing. Hmmm... is there a question hidden somewhere in there or is it more open ended in nature? :) In the meantime... The Absolute Minimum Every Software Developer Absol

Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Hrvoje Niksic
Jed Smith writes: > On Tue, Oct 19, 2010 at 1:37 PM, kj wrote: > >> % stty -echo > > That doesn't do what you think it does. Really? Turning off tty echo sounds exactly like what he wants. Emacs shell echoes characters for you, just like interactive shells do. When you press enter, the charac

proper way to add data dir in buit distribution

2010-10-19 Thread Auré Gourrier
Hi all, Once again I turn to this list for help. I'm trying to build a ditribution for my python package (Python 2.4). The package has the following structure: root |- __init__.py |- module1.py |- ... |-moduleN.py |-subpackage1.py |- __init__.py |- module1.py

Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 2:35 PM, kj wrote: > In Jed Smith > writes: > >>On Tue, Oct 19, 2010 at 1:37 PM, kj wrote: > >>> % stty -echo > >>That doesn't do what you think it does. > > Gee, thanks.  That really helped.  I'll go talk to my guru now, > and meditate over this. You're right, I could

Re: Starting Python in XP Pro

2010-10-19 Thread Grant Andrew
1. Okay, I can open the interpreter and do math. If only I needed the answer to 6*7 I'd be great. But, to your point, Python is installed and working. 2. When I went to the shortcut and hit properties, the path was Target: C:\Python26\Lib\idlelib\idle.bat Start in: C:\Python26\ I cd'd to C:\P

Re: Script to capture stderr of subprocess

2010-10-19 Thread Arnaud Delobelle
"jslow...@gmail.com" writes: > We have a lot of curses-based console applications running on linux. I > would like to write a wrapper script that notifies us if the > application terminates unexpectedly. With my first, obviously naive > attempt, the subprocess dies instantly. STDIN and STDOUT wil

Unicode questions

2010-10-19 Thread Tobiah
I've been reading about the Unicode today. I'm only vaguely understanding what it is and how it works. Please correct my understanding where it is lacking. Unicode is really just a database of character information such as the name, unicode section, possible numeric value etc. These points of i

Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread kj
In Jed Smith writes: >On Tue, Oct 19, 2010 at 1:37 PM, kj wrote: >> % stty -echo >That doesn't do what you think it does. Gee, thanks. That really helped. I'll go talk to my guru now, and meditate over this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Deferring a function call

2010-10-19 Thread Werner Thie
For me nothing beats using twisted ( http://www.twistedmatrix.com ) with its clean implementation of deferreds and a host of other useful things for simulations besides being the 'Swiss Army Knife' of networking in Python. If you throw in stackless ( http://www.stackless.com ) simulations with

Script to capture stderr of subprocess

2010-10-19 Thread jslow...@gmail.com
We have a lot of curses-based console applications running on linux. I would like to write a wrapper script that notifies us if the application terminates unexpectedly. With my first, obviously naive attempt, the subprocess dies instantly. STDIN and STDOUT will need to connect to the terminal of co

Re: PyCharm

2010-10-19 Thread Albert Hopkins
On Tue, 2010-10-19 at 10:05 -0700, CoffeeKid wrote: > Your video is childish When you have someone called "Kid" calling you childish... that's pretty low. -- http://mail.python.org/mailman/listinfo/python-list

Re: OO and game design questions

2010-10-19 Thread Carl Banks
On Oct 19, 1:19 am, dex wrote: > > I'm not sure if it's a good idea to let an item disappear from your > > inventory by a weak reference disappearing.  It seems a little shaky > > to not know where your objects are being referenced, but that's yout > > decision. > > OK, imagine a MUD, where player

Re: OO and game design questions

2010-10-19 Thread Ian Kelly
On Tue, Oct 19, 2010 at 5:37 AM, Dave Angel wrote: > On 2:59 PM, dex wrote: > >> Using strong references, I have to remove room B from list of rooms, >> and also remove door to room B, as it holds reference to room B. To do >> that, I have to keep list of doors that lead to room B. >> >> Using w

Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 1:37 PM, kj wrote: > % stty -echo That doesn't do what you think it does. -- Jed Smith j...@jedsmith.org -- http://mail.python.org/mailman/listinfo/python-list

Re: pyqt4 Table Widget deleting c/c++ object

2010-10-19 Thread Andrew
On Oct 18, 2:26 pm, Andrew wrote: > I have two issues dealing with the table widget, though they may be > interconnected. I'm not sure. Both delete the cell widgets off of my > table but leave the rows, and then when I have the table update, it > complains the c++ object has been deleted. > > # se

annoying CL echo in interactive python / ipython

2010-10-19 Thread kj
Under some parent shells, both my interactive python as well as ipython, produce an unwanted echoing of the input line. E.g. >>> 1 + 1 1 + 1 2 >>> What's worse, upon exiting the interactive python/ipython session, the terminal is left in echo mode: >>> % date date Tue Oct 19 13:27:47 EDT 2

Re: PyCharm

2010-10-19 Thread CoffeeKid
On Oct 15, 4:06 am, Kai Diefenbach wrote: > On 2010-10-13 23:36:31 +0200, Robert H said: > It sucks. > > http://regebro.wordpress.com/2010/10/14/python-ide-code-completion-test > > Kai Kai, Your video is childish and silly. A lot of IDE's use + to invoke code completion. You purposely did not

Re: Python default search paths

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 12:35 PM, Steven D'Aprano wrote: > On Tue, 19 Oct 2010 06:25:30 -0700, swapnil wrote: >> This is useful for embedding applications where it might be desired that >> only user-defined paths are searched for modules. > > I doubt that very much. I expect that many things will

Re: Python3: Is this a bug in urllib?

2010-10-19 Thread Nitin Pawar
the content is in a loop because it is getting redirected again and again and the interrupt exception is perfectly ok when you press ctrl +c On Tue, Oct 19, 2010 at 10:17 PM, Johannes Bauer wrote: > Hi, > > I've experienced the following behavior with Python3 of which I do not > know if it's a b

Re: Deferring a function call

2010-10-19 Thread TomF
Thanks for the ideas, everyone. functools.partial and lambda expressions seem like a more pythonic way of doing what I want. I don't know whether they're actually more efficient or better, but at least they eliminate the need to carry args around separately. I'd forgotten Python has a sched

Python3: Is this a bug in urllib?

2010-10-19 Thread Johannes Bauer
Hi, I've experienced the following behavior with Python3 of which I do not know if it's a bug or not. On two Python3.1 implementations, Python's urllib hangs when encountering a HTTP 301 (Redirect). The code to reproduce is a one-liner (actually, two-liner), Python from Ubuntu tree: Python 3.1.2

Re: Python default search paths

2010-10-19 Thread Steven D'Aprano
On Tue, 19 Oct 2010 06:25:30 -0700, swapnil wrote: > Python allows adding user defined paths to the module search path by > setting PYTHONPATH environment variable. It also allows to alter the > location of standard python libraries using PYTHONHOME. But there is no > way to "only" have user defin

Re: overriding a property

2010-10-19 Thread Steven D'Aprano
On Tue, 19 Oct 2010 06:39:56 -0700, Lucasm wrote: > Hi, > > A question. Is it possible to dynamically override a property? > > class A(object): > @property > def return_five(self): > return 5 > > I would like to override the property for an instance of A to say the > string 'bla

Re: overriding a property

2010-10-19 Thread John Posner
On 10/19/2010 9:39 AM, Lucasm wrote: Hi, A question. Is it possible to dynamically override a property? class A(object): @property def return_five(self): return 5 I would like to override the property for an instance of A to say the string 'bla'. Is this the sort of thing

Re: overriding a property

2010-10-19 Thread Benjamin Peterson
Lucasm gmail.com> writes: > I would like to override the property for an instance of A to say the > string 'bla'. A.return_five = "blah" -- http://mail.python.org/mailman/listinfo/python-list

overriding a property

2010-10-19 Thread Lucasm
Hi, A question. Is it possible to dynamically override a property? class A(object): @property def return_five(self): return 5 I would like to override the property for an instance of A to say the string 'bla'. -- http://mail.python.org/mailman/listinfo/python-list

Python default search paths

2010-10-19 Thread swapnil
Python allows adding user defined paths to the module search path by setting PYTHONPATH environment variable. It also allows to alter the location of standard python libraries using PYTHONHOME. But there is no way to "only" have user defined paths to python's search paths (sys.path) This is useful

hai

2010-10-19 Thread Viji Kumar S S
http://123maza.com/35/demand120/ -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-19 Thread Chris Torek
>2010/10/17 Steven D'Aprano : >> http://pypi.python.org/pypi/stats In article Vlastimil Brom wrote: >Thanks for this useful module! >I just wanted to report a marginal error triggered in the doctests: > >Failed example: >isnan(float('nan')) >Exception raised: >Traceback (most recent cal

Re: OO and game design questions

2010-10-19 Thread Roy Smith
dex wrote: > I'm building a turn based RPG game as a hobby. The design is becoming > increasingly complicated and confusing Such is often the case in real life code :-) > In turn-based games, the order of action execution in battle can give > unfair advantage to players. [...] Is there a design

Re: OO and game design questions

2010-10-19 Thread Dave Angel
On 2:59 PM, dex wrote: I'm not sure if it's a good idea to let an item disappear from your inventory by a weak reference disappearing. It seems a little shaky to not know where your objects are being referenced, but that's yout decision. OK, imagine a MUD, where players can "dig out" new rooms

Re: User interaction with Python

2010-10-19 Thread Wolfgang Meiners
Am 19.10.10 11:31, schrieb Peter Otten: > Wolfgang Meiners wrote: >> >> newString = edit(oldString) >> > > When readline is available: > > http://mail.python.org/pipermail/python-list/2009-June/1209309.html Thank you for this hint. Wolfgang -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple logging example doesn't work!

2010-10-19 Thread Chris Torek
>On Oct 18, 10:45 pm, "robinsieb...@gmail.com" >wrote: >> If I setlogging.basicConfig() call tologging.INFO, then I see info >> messages in the logfile. I only want to see error messages in the >> logfile. I am not sure how good the documentation is (having not gone back to look at it) but I had

Re: Deferring a function call

2010-10-19 Thread Peter Otten
TomF wrote: > I'm writing a simple simulator, and I want to schedule an action to > occur at a later time. Basically, at some later point I want to call a > function f(a, b, c). But the values of a, b and c are determined at > the current time. > > One way way to do this is to keep a list of en

Re: User interaction with Python

2010-10-19 Thread Peter Otten
Wolfgang Meiners wrote: > I would like to have a function to edit values in a database. > > So I am reading values from the database and do something like > > newString = edit(oldString) > > and then oldString is written to the screen and can be edited in a > vi-like manner for example. The fu

Re: Windows: getting notification about power state changes

2010-10-19 Thread Tim Golden
On 19/10/2010 10:06, Gelonida wrote: I'd like to be notified about certain events and call certain python functions depending on the event. call a function: - before (or after) the screen saver kicks in - before (or after) the monitor is switched off - before (or after) the hard disk is switched

Re: choose value from custom distribution

2010-10-19 Thread Peter Otten
Chris Rebert wrote: > On Mon, Oct 18, 2010 at 11:40 PM, Arnaud Delobelle > wrote: >> elsa writes: >>> Hello, >>> >>> I'm trying to find a way to collect a set of values from real data, >>> and then sample values randomly from this data - so, the data I'm >>> collecting becomes a kind of probabil

Windows: getting notification about power state changes

2010-10-19 Thread Gelonida
Hi, I wondered how I could achieve this. I'd like to be notified about certain events and call certain python functions depending on the event. call a function: - before (or after) the screen saver kicks in - before (or after) the monitor is switched off - before (or after) the hard disk is swi

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-19 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Tue, 19 Oct 2010 11:53:40 +1100, Ben Finney wrote: Steven D'Aprano writes: On Mon, 18 Oct 2010 11:56:39 +0200, Jean-Michel Pichavant wrote: I already have a stats module: /usr/lib/python2.5/site-packages/stats.py The name of my module is n

User interaction with Python

2010-10-19 Thread Wolfgang Meiners
Hello all, I would like to have a function to edit values in a database. So I am reading values from the database and do something like newString = edit(oldString) and then oldString is written to the screen and can be edited in a vi-like manner for example. The function edit should return the

Re: Catching a SIGSEGV signal on an import

2010-10-19 Thread Chris Torek
(I realize this is old but I am recovering from dental surgery and, while on the Good Drugs for the pain, going through old stuff on purpose :-) ) >On Thu, 09 Sep 2010 05:23:14 -0700, Ryan wrote: >> In general, is there anyway to catch a SIGSEGV on import? In article , Nobody wrote: >No. If SI

Re: OO and game design questions

2010-10-19 Thread dex
> I'm not sure if it's a good idea to let an item disappear from your > inventory by a weak reference disappearing.  It seems a little shaky > to not know where your objects are being referenced, but that's yout > decision. OK, imagine a MUD, where players can "dig out" new rooms. Room A has a doo

Re: Getting returncode of a command executed with Popen through xterm

2010-10-19 Thread Diez B. Roggisch
amfr...@web.de writes: > Hi, > > i have a program that have to execute linux commands. I do it like this: > > retcode = Popen(["xterm", "-e", command],stdin=PIPE, stdout=PIPE, > stderr=PIPE) > > I have to use xterm because some commands need further input from the > user after they are executed. >

  1   2   >