Re: Python programming books

2011-02-23 Thread Joel Koltner
"John Bokma" wrote in message news:87oc63nvuo@castleamber.com... I also like the "Python Essential Reference" a lot. I'd second that. "Python Essential Reference" effectively documents the "batteries included" aspect of Python, using lots of good examples in a quite readable tome. --

Re: If/then style question

2010-12-16 Thread Joel Koltner
"Steven D'Aprano" wrote in message news:4d0aa5e7$0$29997$c3e8da3$54964...@news.astraweb.com... It doesn't look like you were learning Python. It looks like you were learning C with Python syntax :( True, although in many cases one has to interface to legacy C code where it'd be rather more co

Re: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Joel Koltner
Hi John, "John Nagle" wrote in message news:4c75768a$0$1608$742ec...@news.sonic.net... You don't need a queue, though; just use your own "write" function with a lock. Hmm... that would certainly work. I suppose it's even more efficient than a queue in that the first thing the queue is

Re: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Joel Koltner
"Thomas Jollans" wrote in message news:mailman.36.1282762569.29448.python-l...@python.org... I expect that it gives away the GIL to call the resident write() function, to allow other threads to run while it's sitting there, blocking. I haven't looked at the code, so maybe it doesn't hand over t

Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Joel Koltner
is copacetic here? If not I can just add a queue and have everything go through it, but of course I'd like to avoid the extra code and CPU cycles if it isn't at all necessary. Thank you, ---Joel Koltner -- http://mail.python.org/mailman/listinfo/python-list

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Joel Koltner
"John Nagle" wrote in message news:4beb15c5$0$1634$742ec...@news.sonic.net... Having actually used LISP systems with "edit and continue", it's a good thing that Python doesn't have it. It encourages a "patch" mentality, and the resulting code is usually disappointing. Hey, a lot of people

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Joel Koltner
"Phlip" wrote in message news:c014ae9f-99d8-4857-a3f7-e6ac16e45...@e34g2000pra.googlegroups.com... Are you implying, after an edit, you need to start a program again, then enter several user inputs, to navigate back to the place where you hit the syntax error? (WxWidgets noted - props!) Pretty

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Joel Koltner
"Phlip" wrote in message news:75c050d2-365e-4b08-8716-884ed5473...@k25g2000prh.googlegroups.com... On May 12, 12:44 pm, "Joel Koltner" wrote: Are you implying that you then run the code, and - after a handful of higher-level calls - control flow gets down to the lines you

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Joel Koltner
"Phlip" wrote in message news:d580dece-bd42-4753-a0c6-783ce69b5...@m31g2000pre.googlegroups.com... People who need "edit and continue" probably need developer tests instead. You typically edit the test a little, run all the code, edit the code a little, run all the code, and integrate whenever t

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Joel Koltner
"Terry Reedy" wrote in message news:mailman.119.1273690025.32709.python-l...@python.org... CPython compiles Python code (a sequence of statements) to its private bytecode (a sequence of codes and operands) and then interprets the bytecode. So 'edit and continue' would have to recompile the stat

Do any debuggers support "edit and continue?"

2010-05-12 Thread Joel Koltner
the line in question and keep going, rather than having to stop the entire program, fix the line, and then run again and potentially kill a bunch of time getting the program back into the same "state." Thanks, ---Joel Koltner -- http://mail.python.org/mailman/listinfo/python-list

Re: len() should always return something

2009-07-27 Thread Joel Koltner
"Dr. Phillip M. Feldman" wrote in message news:mailman.3699.1248490256.8015.python-l...@python.org... > Here's a simple-minded example: ... > This function works fine if xs is a list of floats, but not if it is single > float. It can be made to work as follows: Wow, you could substitute "Matlab

Re: Q: "Best" book for teaching

2009-04-08 Thread Joel Koltner
"Lawrence D'Oliveiro" wrote in message news:grhq75$eb...@lust.ihug.co.nz... > I thought that a good introduction might be to show them how HTML works, and > progress from there to embedding little bits of JavaScript. > > Nothing to do with Python I know, but might be a possibility. If you want t

Library for generating indicators and graphs for weather stations

2009-03-17 Thread Joel Koltner
Hello, Could someone suggest a Python library for generating the indicators and graphs that "weather station software" typically produces, e.g., similar to those seen here: http://www.weather-display.com/wdfull.html ... and here: http://www.weather-display.com/index.php ? I did stumble across

Re: Easy-to-use Python GUI

2009-01-06 Thread Joel Koltner
Thanks to everyone who responded; I'll be checking out the various toolkits people have listed! ---Joel -- http://mail.python.org/mailman/listinfo/python-list

Re: SQL, lite lite lite

2008-12-31 Thread Joel Koltner
"Gerhard Häring" wrote in message news:6rvgihf3je6...@mid.uni-berlin.de... > Using an ORM when you don't grasp the relational model and/or the SQL query > language is futile. You'd probably be surprised just how many people there are out there using SQLlite (and other databases) who have no mo

Easy-to-use Python GUI

2008-12-24 Thread Joel Koltner
Is there an easy-to-use, "function"-based cross-platform GUI toolkit for Python out there that's a little more sophisticated than EasyGui? EasyGui looks good, but it's a little more restrictive than what I'd like to have, yet I'm (stubbornly :-) ) resistant to stepping up to a "full service" GU

Re: One step up from str.split()

2008-07-15 Thread Joel Koltner
"Sion Arrowsmith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What's wrong with sys.argv ? Mainly that it doesn't exist. :-) The example was slightly contrived -- I'm really dealing with commands interactively entered within a program in response to raw_input(), although the

Re: One step up from str.split()

2008-07-14 Thread Joel Koltner
Thanks Matt, that looks like just what I want! -- http://mail.python.org/mailman/listinfo/python-list

One step up from str.split()

2008-07-14 Thread Joel Koltner
I normally use str.split() for simple splitting of command line arguments, but I would like to support, e.g., long file names which-- under windows -- are typically provided as simple quoted string. E.g., myapp --dosomething --loadthis "my file name.fil" ...and I'd like to get back a list wher

Re: ��python in a nutshell��and��programming python��

2008-06-18 Thread Joel Koltner
"yps" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > as a new learner of python,which book in and > is more suitable? I don't have "Python in a Nutshell," but let me ask... do you have a strong programming background in C++, Java, etc.? If so, you'll probably find "Programming

Re: php vs python

2008-06-04 Thread Joel Koltner
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I think you are talking about something a little different than Arnaud. Ah, OK. > Other old habits from people coming to Python are: using indexes where they > are not needed, trivial getters and setters, pu

Re: php vs python

2008-06-02 Thread Joel Koltner
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This is wrong, because if you know well one language only, you tend to > think that the principles that underpin it are universal. So you will > try to shoehorn these principles into any other language you use. Fair

Re: php vs python

2008-06-01 Thread Joel Koltner
"Ethan Furman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jerry Stuckle wrote: > > As I've said before - good programmers can write good code in any > > language. > So... an eloquent speaker of English is also an eloquent speaker of > Spanish/French/German? There's potentially

Re: Weird exception in my, um, exception class constructor

2008-05-27 Thread Joel Koltner
"Paul Hankin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] "Did you actually write self,args = args?" (looks at source code) [EMAIL PROTECTED] Why, yes, yes I did! Thanks for catching that... -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird exception in my, um, exception class constructor

2008-05-27 Thread Joel Koltner
Hi Arnaud, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > That's because the class 'Exception' defines a descriptor 'args' which > has to be a sequence. Ah, thanks. I was following the example in Beazley's book and should have dug into the actual documentation

Weird exception in my, um, exception class constructor

2008-05-27 Thread Joel Koltner
I have a generic (do nothing) exception class that's coded like this: class MyError(exceptions.Exception): def __init__(self,args=None): self.args = args When I attempt to raise this exception via 'raise MyError' I get an exception within the MyError constructor __init__ as follows:

Re: Reloading function obtained via 'from xxx import yyy'

2008-05-23 Thread Joel Koltner
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Try all three of them, in sequence: Thanks, will do. > If you absolutely don't want to import test, write I can live with the import, I just don't want to have to type out the full names all the time. ---Joel

Reloading function obtained via 'from xxx import yyy'

2008-05-23 Thread Joel Koltner
How do I get Python to correctly re-load this function definition? In test.py: def testFunc(): print 'My testFunc!' I execute... >>> from test import testFunc >>> testFunc() My testFunc! Fine... now I change test.py to: def testFunc(): print 'Modified testFunc!' ...and I'd like to re

Re: Producing multiple items in a list comprehension

2008-05-22 Thread Joel Koltner
Hi Marc, "Marc Christiansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm not sure I would recommend it, but try: > [v for x in range(4) for v in (x, 2 * x)] That certainly works... and it almost seems like a bit less of a hack (if perhaps somewhat harder to read) than the

Re: Producing multiple items in a list comprehension

2008-05-22 Thread Joel Koltner
"inhahe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i figured out a solution > > sum([x,2*x] for x in range(4)],[]) #not tested Nice... thanks; I probably had seen code using 'sum' to flatten but hadn't actually understood how it worked. After playing around some it's now cl

Re: Producing multiple items in a list comprehension

2008-05-22 Thread Joel Koltner
"Peter Otten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> A slightly similar problem: If I want to "merge," say, list1=[1,2,3] ... items = [None] * 6 items[::2] = 1,2,3 items[1::2] = 4,5,6 items > [1, 4, 2, 5, 3, 6] Thanks Peter, that's pretty clean -- I lik

Producing multiple items in a list comprehension

2008-05-22 Thread Joel Koltner
Is there an easy way to get a list comprehension to produce a flat list of, say, [x,2*x] for each input argument? E.g., I'd like to do something like: [ [x,2*x] for x in range(4) ] ...and receive [ 0,0,1,2,2,4,3,6] ...but of course you really get a list of lists: [[0, 0], [1, 2], [2, 4], [3,