Re: those darn exceptions

2011-06-27 Thread John Nagle
hich usually should cause termination or fairly drastic recovery action) and normal external events (which have to be routinely handled.) It's quite possible to get a OSError on "os.kill()" for a number of legitimate reasons. The target process may have exited since the PID was obtai

Re: Using decorators with argument in Python

2011-06-29 Thread John Posner
be used as a decorator: prints a line of before/after the function's output """ class _class_to_use_as_decorator: def __init__(self, funarg): self.func = funarg def __call__(self, *args, **kwargs): print "\n" + repeat_char * 50 self.func(*args, **kwargs) print repeat_char * 50 + "\n" return _class_to_use_as_decorator Best, John -- http://mail.python.org/mailman/listinfo/python-list

Re: How to import data from MySQL db into excel sheet

2011-06-30 Thread John Nagle
s not necessary. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: text file

2011-06-30 Thread John Gordon
e: python samples.py > textfile And it will save the output in "textfile". -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: Using decorators with argument in Python

2011-07-01 Thread John Posner
c() > print(self.char * 50 + '\n') > I believe the "if" block should be: if func is None: self._call() return Or perhaps the _call() method should be revised: def _call(self): print("\n" + self.char * 50) retval = sel

Why won't this decorator work?

2011-07-02 Thread John Salerno
I thought I had finally grasped decorators, but the error I'm getting ('str' type is not callable) is confusing me. Here is my code. Also, the commented sentence is from the Python docs, which says it doesn't even need to be callable, if that matters. I also commented out a few things in the move m

Re: Why won't this decorator work?

2011-07-02 Thread John Salerno
On Jul 2, 12:33 pm, MRAB wrote: > On 02/07/2011 17:56, John Salerno wrote: > > > > > > > > > > > I thought I had finally grasped decorators, but the error I'm getting > > ('str' type is not callable) is confusing me. Here is my code. Also,

Re: Why won't this decorator work?

2011-07-02 Thread John Salerno
On Jul 2, 1:45 pm, Tim Chase wrote: > I must not be looking at the same documentation you are...could > you provide a link? The only time I know of that the return value > of a decorator need not be callable is if you want to totally > break the syntax of the function. :-/ http://docs.python.org

Re: Why won't this decorator work?

2011-07-02 Thread John Salerno
On Jul 2, 9:11 pm, Steven D'Aprano wrote: > John Salerno wrote: > > But why does the documentation say "The return value of the decorator > > need not be callable"? > > The thing returned by a decorator does not need to be callable, but if you > want to cal

Anyone want to critique this program?

2011-07-02 Thread John Salerno
Just thought I'd post this in the event anyone has a few spare minutes and feels like tearing apart a fairly simple attempt to write a game. :) I'll paste the exercise I was working on first, although I think it was meant to be an exercise in how to use lists. I went way beyond that, so maybe my p

Re: Anyone want to critique this program?

2011-07-02 Thread John Salerno
On Jul 2, 10:02 pm, Chris Angelico wrote: > > game_information = '***Chutes and Ladders***\nUp to four (4) players > > may play.\n'\ > >                   'There are 90 spaces on the board. '\ > >                   'The player to reach space 90 first wins.' > > I'd do this with a triple-quoted st

Re: Why won't this decorator work?

2011-07-03 Thread John Salerno
On Jul 3, 1:01 pm, "OKB (not okblacke)" wrote: > subsequent calls to it will behave differently.  If you want ALL calls > to your method to roll a die to get a random number, and then use that > random number, why not just roll the die inside the method itself: I thought maybe it would be cleane

Re: Anyone want to critique this program?

2011-07-03 Thread John Salerno
On Jul 3, 1:06 pm, "OKB (not okblacke)" wrote: > > Yeah, I considered that, but I just hate the way it looks when the > > line wraps around to the left margin. I wanted to line it all up > > under the opening quotation mark. The wrapping may not be as much > > of an issue when assigning a variabl

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread John Gordon
ctor warns me not to add a link, although perhaps it's > time for recalibration (after all, summer season started) :-) He's not asking for a link to the "Implicit initialization is EVIL" thread; he's asking for a link to the original article he read elsewhere which praised

Re: Implicit initialization is EXCELLENT

2011-07-05 Thread John Gordon
In John Gordon writes: > which praised the bendfists of implicit initialization. Wow, that's quite a typo! I meant "benefits", of course. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil,

more advanced learning resources (code structure, fundamentals)

2011-07-07 Thread John [H2O]
hich I find helpful, but the styles of programming vary significantly. Perhaps someone could say which modules have nice 'exemplary' code worth learning from? So, if someone has a good book or online reference, please point me to it. Other ideas too are most certainly welcome! Best, joh

Re: find max and min values from a column of a csv file

2011-07-07 Thread John [H2O]
I think you would benefit from reading the data into a numpy array first, then using numpy min, max functions. prakash jp wrote: > > Hi All , > > Could any one help to get max and min values from a specified column of a > csv file. The* csv file is large* and hence the below code did go bad.

Re: i get different answers based on run platform

2011-07-07 Thread John Gordon
ed character hanging at the end of the input line, which upsets the palindromic balance?) By the way, I could not make your program work as you provided it; I had to replace input() with raw_input(). Does it really work for you this way? -- John Gordon A is for Amy, who fell

Re: String concatenation vs. string formatting

2011-07-08 Thread John Gordon
it silly, but I'm a novice when it comes to > design. Plus, there's not really supposed to be "more than one way to do > it" in Python. Concatenation feels ugly/clunky to me. I prefer this usage: logger.error('%s could not be stored - %s' % \ (self.preset_

How can I make a program automatically run once per day?

2011-07-09 Thread John Salerno
I have a script that does some stuff that I want to run every day for maybe a week, or a month. So far I've been good about running it every night, but is there some way (using Python, of course) that I can make it automatically run at a set time each night? -- http://mail.python.org/mailman/listi

Re: How can I make a program automatically run once per day?

2011-07-09 Thread John Salerno
Thanks everyone! I probably should have said something like "Python, if possible and efficient, otherwise any other method" ! :) I'll look into the Task Scheduler. Thanks again! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get or set the text of a textfield?

2011-07-10 Thread John Gordon
list of methods that are defined by that object. Hopefully one of them will be called something helpful like set_text() or set_property(). Once you know the method name, you might try a Google search to determine the exact usage and arguments. -- John Gordon A is for Amy, who

Re: How to get or set the text of a textfield?

2011-07-11 Thread John Gordon
In Adam Tauno Williams writes: > Google, or Bing, or even DuckDuckGo, are *not* your friends. They are > enormous and inefficient time-sinks. They are a *BAD* way to solve > problems. Use the documentation. One would hope that a Google search might lead to the documentation.

Re: Property setter and lambda question

2011-07-11 Thread John Posner
ssignment'). I'd use > pass a setter method anyway. > > What is your preferred solution? Anthony, you might take a look at this alternative writeup for "property", which I placed on the Python Wiki: http://wiki.python.org/moin/AlternativeDescriptionOfProperty

"Python Wizard," with apologies to The Who

2011-07-12 Thread John Keisling
After too much time coding Python scripts and reading Mark Lutz's Python books, I was inspired to write the following lyrics. For those too young to remember, the tune is that of "Pinball Wizard," by The Who. May it bring you as much joy as it brought me! I cut my teeth on BASIC At scripting I'm

Re: "Python Wizard," with apologies to The Who

2011-07-12 Thread John Keisling
On Jul 12, 11:34 am, Tim Daneliuk wrote: > On 7/12/2011 12:08 PM, Tim Daneliuk said this: > > > On 7/12/2011 11:40 AM, John Keisling said this: > >> After too much time coding Python scripts and reading Mark Lutz's > >> Python books, I was inspired to wr

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
None]? It might help if you posted the method signature of the Oracle stored procedure you're trying to call. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
ot;, which is the prodecure called by your code. Where is this procedure? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
he OUT variable p, with some value. It doesn't have to be a > cursor fetch; even a minor text assignment. That procedure is defined as taking one parameter, but you're passing an empty parameter list. Why? -- John Gordon A is for Amy, who fell down the stairs gor

Re: "Python Wizard," with apologies to The Who

2011-07-13 Thread John Keisling
On Jul 12, 7:02 pm, Steven D'Aprano wrote: > John Keisling wrote: > > After too much time coding Python scripts and reading Mark Lutz's > > Python books, I was inspired to write the following lyrics. For those > > too young to remember, the tune is that of "Pin

Re: "Python Wizard," with apologies to The Who

2011-07-13 Thread John Keisling
On Jul 13, 6:53 am, Chris Angelico wrote: > On Wed, Jul 13, 2011 at 10:46 PM, bruno.desthuilli...@gmail.com > > wrote: > > On Jul 12, 6:40 pm, John Keisling wrote: > >> After too much time coding Python scripts and reading Mark Lutz's > >> Python books,

Re: "Python Wizard," with apologies to The Who

2011-07-13 Thread John Keisling
On Jul 13, 12:32 pm, rantingrick wrote: > On Jul 13, 10:14 am, rusi wrote: > > > Well written, funny, educative. Thanks > > But whats 'the modeling and sym guy' reference? > > I believe it's "esoteric". I actually had myself in mind, with tongue in cheek, of course! I work in modeling and simula

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
ven't worked with OUT parameters so I don't know if this will work, but try it and see what happens: my_string = "" p = [my_string] c.callproc('c2_pkg.RS22', p); print p -- John Gordon A is for Amy, who fell down the stairs gor...@panix.

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
s that is how the example code does it. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: python error PLS-00306: wrong number or types of arguments in

2011-07-13 Thread John Gordon
ckage, actually works, but > then you lose access to private data; which is while I used a package. Did you try changing RS22 from a procedure to a function inside the package? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for B

Re: Use self.vars in class.method(parameters, self.vars)

2011-07-22 Thread John Gordon
e capwords convention > * class Foo > * class FooBar > * class FooBarBaz But those names do, in fact, start with an uppercase letter as Bruno said. Perhaps Bruno omitted how the remainder of the name should be handled, but he was certainly right about the first letter being capital

Re: PEP 8 and extraneous whitespace

2011-07-22 Thread John Gordon
is to help the poor sod who will eventually get stuck working with your code on an 80-column fixed width terminal window. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edw

Re: What Programing Language are the Largest Website Written In?

2011-07-22 Thread John Nagle
efore Google bought it, was in Python. But it's since been rewritten. All the stuff that actually handles video is, of course in C/C++. The load of handling the video dwarfs the user interface load. Wikipedia is indeed written in PHP. John Nagle --

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-23 Thread John Nagle
"if" is un-Pythonic. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: I am fed up with Python GUI toolkits...

2011-07-24 Thread John Nagle
ernal dependencies, though (different dependencies for each platform, so it requires a lot to be cross-platform). It still uses Tcl/Tk stuff, which is un-Pythonic. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: a little parsing challenge ☺

2011-07-24 Thread John O'Hagan
elif char in closers: if still_open and char == openers[still_open[-1][1]]: still_open.pop() else: close_errors.append((index, char)) if still_open or close_errors: return min(still_open[:1] + close_errors[:1])[0] although you might as well return still_open + close_errors and see them all. Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter/py2exe with installer

2011-07-25 Thread John Posner
Inno Setup 5.4.0(a) to create the "ClixTur" executable at http://www.jjposner.net/5273.html Inno Setup gives the executable an execrable name (looks like a GUID), but it works fine. HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter/py2exe with installer

2011-07-25 Thread John Posner
Inno Setup 5.4.0(a) to create the "ClixTur" executable at http://www.jjposner.net/5273.html Inno Setup gives the .exe file a GUID for a name (ugh!) but it works fine. HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Pipe in the "return" statement

2011-07-25 Thread John Gordon
n; the bitwise OR of both values is computed and that value is returned. It seems that you don't understand what the term "bitwise or" means. Perhaps a Google search might help. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.c

Re: ActivePython: multiple versions on OSX?

2011-07-26 Thread John Roth
might also want to look at PEP 394: http://www.python.org/dev/peps/pep-0394/ It can simplify writing scripts which select the version you want. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I make a program automatically run once per day?

2011-07-26 Thread John Salerno
On Jul 9, 9:01 pm, John Salerno wrote: > Thanks everyone! I probably should have said something like "Python, > if possible and efficient, otherwise any other method" ! :) > > I'll look into the Task Scheduler. Thanks again! Hmm, okay I'm finally trying Task Sched

Re: How can I make a program automatically run once per day?

2011-07-26 Thread John Salerno
On Jul 26, 9:22 pm, Andrew Berg wrote: > On 2011.07.26 08:05 PM,JohnSalernowrote:> Hmm, okay I'm finally trying Task > Scheduler, but how do I set it to > > run a Python script? It seems to not work, I suppose because it's > > running the script but doesn't know how to find Python to run it > > p

Re: Only Bytecode, No .py Files

2011-07-27 Thread John Roth
ry) > open("/etc/ld.so.cache", O_RDONLY)      = 3 > > So can it really be such a huge problem? > > Thomas Two comments. First, your trace isn't showing attempts to open .py files, it's showing attempts to open the Curses library in the bash directory. Maybe you also have a problem with the .py files, but it isn't documented in this trace. It's also not showing the program that's causing the failing open. Second, the audit program is an idiot. There are lots of programs which use the "easier to ask forgiveness" pattern and test for the existence of optional files by trying to open them. This may be what Bash is doing. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I make a program automatically run once per day?

2011-07-27 Thread John Salerno
On Jul 27, 7:58 am, Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote: > On 07/27/2011 08:35 AM, Chris Angelico wrote: > > > > > > > > > > > On Wed, Jul 27, 2011 at 10:27 PM, Dave Angel  wrote: > >> As Chris pointed out, you probably aren't getting the script's directo

Re: Only Bytecode, No .py Files

2011-07-29 Thread John Roth
On Jul 27, 8:56 am, Thomas Rachel wrote: > Am 27.07.2011 14:18 schrieb John Roth: > > > Two comments. First, your trace isn't showing attempts to open .py > > files, it's showing attempts to open the Curses library in the bash > > directory. > > Of c

Re: os.path.dirname(sys.argv[0]) always returns nothing

2011-08-01 Thread John Gordon
results from os.path.dirname: >>> import os >>> os.path.dirname('foo.py') '' >>> Are you trying to obtain the full pathname of the program? That's an entirely different question. -- John Gordon A is for Amy, who fell down the s

Re: making my extensions work together

2011-08-03 Thread John Gordon
sure what you mean by "extension", but it might not be relevant. Are these extensions, whatever they may be, part of the same program? Or are they separate? > This doesn't work. When one of my extensions changes the variable value, the > other extension does not see the change.

JSON Strict Mode

2011-08-04 Thread John Riselvato
I am working on a license verification script. I am rather new to the concept and to JSON files in general. This is what my pseudocode looks like: licenses = meta['license'] > for x in licenses: > if licenses[x]['terms'] is not valid opensource license > if in strict mode >

Re: PyWhich

2011-08-05 Thread John Gordon
In <4e3bf554$0$29976$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano writes: > Doh! I *always* conflate env and which. Thank you for the correction. Way to say "conflate"! :-) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.c

Re: Replace all references to one object with references to other

2011-08-05 Thread John Gordon
that is a very naive solution and can easily fail based on lots of factors. What's your context: A single source file? Many source files? A live application with persistent data? What are your two objects? Do they provide an identical interface? -- John Gordon A is for

Re: Replace all references to one object with references to other

2011-08-05 Thread John Gordon
In John Gordon writes: > In Jack Bates > writes: > > I have two objects, and I want to replace all references to the first > > object - everywhere - with references to the second object. What can I > > try? > The simplest answer to your question is to assign ob

Re: how to separate a list into two lists?

2011-08-06 Thread John Posner
x27;), (2,'b'), (3,'c'), (4,'d') ] >>> zip(*L) [(1, 2, 3, 4), ('a', 'b', 'c', 'd')] HTH, John [1] http://docs.python.org/library/functions.html -- http://mail.python.org/mailman/listinfo/python-list

Re: how to separate a list into two lists?

2011-08-06 Thread John Posner
x27;), (2,'b'), (3,'c'), (4,'d') ] >>> zip(*L) [(1, 2, 3, 4), ('a', 'b', 'c', 'd')] HTH, John [1] http://docs.python.org/library/functions.html -- http://mail.python.org/mailman/listinfo/python-list

Restricted attribute writing

2011-08-07 Thread John O'Hagan
ength): self.__order = Order(lis, length) self.length = length @property def order(self): return self.__order @order.setter def order(self, lis): if not isinstance(lis, Order): lis = Order(lis, self.length) self.__order = lis -- John O'Hagan -- http://mail.python.org/mailman/listinfo/python-list

Wait for a keypress before continuing?

2011-08-07 Thread John Doe
My program does not need a prompt, it just needs to wait for any key to be pressed before it continues. This is in Windows. char=0 while not char: char=msvcrt.getch() That doesn't delay anything here. while 1: char=msvcrt.getch() break That appears to put my program into an

Re: Wait for a keypress before continuing?

2011-08-07 Thread John Doe
Steven D'Aprano wrote: > Also, are you using an IDE? If so, it could very well be > interfering with the keyboard buffer I really don't know how to answer your question. I am using Windows XP SP3. Komodo Edit 6 for editing the *.py file. Dragon Naturally Speaking, Natlink, and Dragonfly mig

Re: Restricted attribute writing

2011-08-07 Thread John O'Hagan
On Mon, 08 Aug 2011 03:07:30 +1000 Steven D'Aprano wrote: > John O'Hagan wrote: > > > I'm looking for good ways to ensure that attributes are only writable such > > that they retain the characteristics the class requires. > > That's what properties a

Re: How to solve this problem

2011-08-09 Thread John Gordon
administrators. And what does this question have to do with python? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" --

Re: Complex sort on big files

2011-08-09 Thread John Nagle
al product) but few people need them. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Docstrings and class Attributes

2011-08-10 Thread John Pinner
gt; > Properties, like any function in Python, have docstrings. So are you saying that men's nipples are pointless? You could be correct, except in cold weather maybe. John -- > > They're an accident of the history that led to their implementation, and > of the pre-existing

Re: TypeError: 'module' object is not callable

2011-08-11 Thread John Gordon
s problem when you haven't shown us the code for Univariate. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Use-Once' Variables and Linear Objects

2011-08-12 Thread John Nagle
his is mostly a curiosity. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Data issues with Django and Apache

2011-08-13 Thread John Gordon
It almost seems like Apache is maintaining its own persistent session or something, and restarting Apache causes the session to be flushed. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Data issues with Django and Apache

2011-08-14 Thread John Gordon
x27;m somewhat pressed for time. I was just hoping that someone would recognize the problem from the few symptoms I gave. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edwa

Re: Data issues with Django and Apache

2011-08-15 Thread John Gordon
In John Gordon writes: > The problem is that I get conflicting results as to whether these temporary > records have reached their expiration date, depending if I search for them > via an Apache web call or if I do the search locally from a python shell. > And to make it weirder, t

Re: testing if a list contains a sublist

2011-08-16 Thread John Posner
== 0: return True # empty list *is* a sublist elif slist_sz == alist_sz and alist == slist: return True elif slist_sz > alist_sz: return False # standard case for i in range(alist_sz - slist_sz + 1): if slist == alist[i:i+sl

Re: testing if a list contains a sublist

2011-08-16 Thread John Posner
== 0: return True # empty list *is* a sublist elif slist_sz == alist_sz and alist == slist: return True elif slist_sz > alist_sz: return False # standard case for i in range(alist_sz - slist_sz + 1): if slist == alist[i:i+sl

Re: why i cannot import djang?

2011-08-16 Thread John Gordon
ion you're running, the version number should be displayed when you start up a python shell, like this: command prompt> python Python 2.3.4 (#1, Apr 15 2011, 17:38:51) [GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2 Type "help", "copyright", "cr

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
def wait_for_keystroke(): char=0 while not char==0x1B: char=msvcrt.getch() That freezes the process. Am I using the right code for the escape key, or doing anything else wrong? Again, I know it could be my system. But I must find a way to do this from within Windows. I use a keyboard ho

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
> def wait_for_keystroke(): > char=0 > while not char==0x1B: > char=msvcrt.getch() I tried using while not char==chr(27): -- http://mail.python.org/mailman/listinfo/python-list

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
def wait_for_keystroke(): char=0 while not (char==chr(27) or char==chr(110)): char=msvcrt.getch() if char==0: return That freezes the process. That means char=msvcrt.getch() is getting something? Could it have something to do with the formatting of the character? -- http://mail.

Determine what msvcrt.getch() is getting?

2011-08-16 Thread John Doe
Whatever msvcrt.getch() is returning here in Windows, it's not within the 1-255 number range. How can I determine what it is returning? I would like to see whatever it is getting. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
Tim Roberts wrote: > John Doe wrote: > >>def wait_for_keystroke(): >> char=0 while not (char==chr(27) or char==chr(110)): >>char=msvcrt.getch() if char==0: >> return >> >>That freezes the process. > > That exact code works perf

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread John Gordon
t convey the same meaning as "used to wear." "wore" means you have worn them in the past. "used to wear" means you have worn them in the past AND don't intend to do so again. -- John Gordon A is for Amy, who fell dow

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
Okay... Looks like I need pyHook. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread John Gordon
ure. Not even YOU can predict whether or not Of course -- that's why the word "intend" was part of my answer. Did you overlook that crucial word? I stand by my assertion that the phrase "I used to do X" carries the meaning that you have done X in the past but DO NOT INTEND t

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
Jerry Hill wrote: > John Doe wrote: >> No. I am running this from within Windows, all sorts of >> Windows. > > What does that mean? You snipped the context, Benny. > You seem very resistant to answering anyone's questions about > your code. No on

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
Seebs wrote: > John Doe wrote: >> Using "does your code have a GUI" produces zero search results. >> Maybe that works better in some other language. > > You shouldn't need a search engine to answer a question about > your code. Context is lost whe

Re: Wait for a keypress before continuing?

2011-08-17 Thread John Doe
Seebs wrote: > John Doe wrote: >> Context is lost when you quote only one level. > > Not significantly. Whatever you say, Jeebs. >> I was not answering a question about my code. I was pointing >> out the fact that my questioner's terminology is >&g

Re: Syntactic sugar for assignment statements: one value to multiple targets?

2011-08-18 Thread John Pinner
gt; > # Gotcha! > > # Other forms of 4 also have this behavior: > > a,b,c,d,e = ({},) * 5>>> a[1] = 1 > >>> b > > {1: 1} > > Alternatively, is there a version of iterable multiplication that > creates new objects rather than just copying the reference? That would > solve part of the problem, though it would still look clunky and you'd > still have to keep count. > > Any thoughts? Thanks! I hesitate to put this forward, as it smells and is probably considered bad practice, but heh! for char in 'abcdefg' : globals()[ char ] = dict() does what you wanted. Best wishes, John -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Measure the amount of memory used?

2011-08-18 Thread John Gordon
easured the memory used by a Python program? How did > you do it? I generally use 'top' to do this for any program. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: How to convert a list of strings into a list of variables

2011-08-18 Thread John Gordon
ed", "one", "maple"] list_of_variables = [] for x in list_of_strings: list_of_variables.append(eval(x)) for y in list_of_variables: print y -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assa

Re: Word Perfect integration

2011-08-18 Thread John Gordon
work than learning wordperfect macros. Just my two cents. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail

Re: Help with regular expression in python

2011-08-18 Thread John Gordon
regexp account for the space in between each float? I can't tell due to your post having a linebreak at a really inconvenient spot. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: HTML client sctript

2011-08-19 Thread John Gordon
be better if this script runs from the clients' side. > Could any one suggest any Python modules, articles, tutorials, ect. that > might be helpful? Mechanize seems like what you want. It's built on top of urllib2. http://wwwsearch.sourceforge.net/mechanize/ -- John Gordon

Re: try... except with unknown error types

2011-08-19 Thread John Gordon
s? Thank you. You can catch all exceptions by catching the base class Exception: try: some_method() except Exception, e: print "some error happened, here is the explanation:" print str(e) -- John Gordon A is for Amy, who fell

Re: try... except with unknown error types

2011-08-19 Thread John Gordon
which should be caught. > You should always catch the absolute minimum you need to catch. I agree, but it did seem to be exactly what he was asking for. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for

Re: Compare tuples of different lenght

2011-08-20 Thread John O'Hagan
emove(t) break return tuples Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Re: try... except with unknown error types

2011-08-20 Thread John Nagle
On 8/19/2011 1:24 PM, John Gordon wrote: In<4e4ec405$0$29994$c3e8da3$54964...@news.astraweb.com> Steven D'Aprano writes: You can catch all exceptions by catching the base class Exception: Except that is nearly always poor advice, because it catches too much: it hides bugs

Adding modified methods from another class without subclassing

2011-08-21 Thread John O'Hagan
likelihood it may not be a good idea. I can almost hear the screams of "No, don't do that!" or the sound of me slapping my forehead when someone says "Why don't you just...". So before I put it in, I'd appreciate any comments, warnings, criticisms, alternatives etc.. Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding modified methods from another class without subclassing

2011-08-22 Thread John O'Hagan
On Mon, 22 Aug 2011 15:27:36 +1000 Steven D'Aprano wrote: > On Mon, 22 Aug 2011 03:04 pm John O'Hagan wrote: > > > The "pitches" attribute represents the instances and as such I found > > myself adding a lot of methods like: > > > > def __g

Re: Adding modified methods from another class without subclassing

2011-08-22 Thread John O'Hagan
On Mon, 22 Aug 2011 11:32:18 +0200 Peter Otten <__pete...@web.de> wrote: > John O'Hagan wrote: > > > I have a class like this: > > > > class MySeq(): > > def __init__(self, *seq, c=12): > > self.__c = c > >

Re: Adding modified methods from another class without subclassing

2011-08-22 Thread John O'Hagan
On Mon, 22 Aug 2011 23:08:50 +1000 John O'Hagan wrote: > On Mon, 22 Aug 2011 15:27:36 +1000 > Steven D'Aprano wrote: [..] > > Looks like a call for (semi-)automatic delegation! > > > > Try something like this: > > > > > > # Untested

Re: Error when deleting and reimporting subpackages

2011-08-22 Thread John Nagle
because the nose testing framework does exactly this kind of thing when loading test modules, causing some very confusing errors and failures. Is this behavior expected? It's undefined behavior. You're dealing with CPython implementation semantics, not Python language semantics.

Re: why i cannot invoke python script using command line?

2011-08-23 Thread John Gordon
l in eclipse > but failed when using python f:\project\src\a.py, what's wrong? > (the error msg shows a.py cannot find b.py) , what should i do in > order to run a.py using command line? What is your PYTHONPATH environment variable setting? -- John Gordon A

<    1   2   3   4   5   6   7   8   9   10   >