Re: Python programming books

2011-02-23 Thread Joel Koltner
John Bokma j...@castleamber.com 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

Re: If/then style question

2010-12-16 Thread Joel Koltner
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

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

2010-08-25 Thread Joel Koltner
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: Can PySerial's write method be called by multiple threads?

2010-08-25 Thread Joel Koltner
Thomas Jollans tho...@jollybox.de 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

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

2010-08-25 Thread Joel Koltner
Hi John, John Nagle na...@animats.com 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

Do any debuggers support edit and continue?

2010-05-12 Thread Joel Koltner
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: Do any debuggers support edit and continue?

2010-05-12 Thread Joel Koltner
Terry Reedy tjre...@udel.edu 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

Re: Do any debuggers support edit and continue?

2010-05-12 Thread Joel Koltner
Phlip phlip2...@gmail.com 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

Re: Do any debuggers support edit and continue?

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

Re: Do any debuggers support edit and continue?

2010-05-12 Thread Joel Koltner
Phlip phlip2...@gmail.com 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

Re: Do any debuggers support edit and continue?

2010-05-12 Thread Joel Koltner
John Nagle na...@animats.com 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

Re: len() should always return something

2009-07-27 Thread Joel Koltner
Dr. Phillip M. Feldman pfeld...@verizon.net 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

Re: Q: Best book for teaching

2009-04-08 Thread Joel Koltner
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand 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

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 g...@ghaering.de 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)

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 GUI

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

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

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 python in a nutshell and programming python 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,

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, putting

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 a large

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: 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 a

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

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 reload

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 --

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],

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 like it! --

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 clear...

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 sum