Command-line tool able to take multiple commands at one time?

2005-11-10 Thread Peter A.Schott
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of working Python scripts to paste into my interactive console and let those run so I don't have to copy l

Re: testing C code with python

2005-11-10 Thread Peter Hansen
ocontroller CPU (68HC12) which was itself implemented in Python. I realize that doesn't help you, but I just thought I'd mention it, because it was a heck of a lot of fun writing it. :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing current time to a file

2005-11-10 Thread Peter Hansen
, and the write() method takes a string, you either do NOT have a "file assigned to log", or you haven't opened it, or perhaps you are expecting to see the output even though you haven't closed the file or flushed it. Maybe showing us the missing code would help... -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: modify dictionary while iterating

2005-11-11 Thread Peter Otten
v == 2] >>> for k in delenda: ... del a[k] ... >>> a {'a': 1, 'c': 3} If you expect to delete most items: >>> a = dict(a=1, b=2, c=3, d=2) >>> a = dict((k, v) for k, v in a.iteritems() if v != 2) >>> a {'a': 1, &

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Peter A.Schott
e "Devan L" <[EMAIL PROTECTED]> wrote: > > Peter A. Schott wrote: > > Per subject - I realize I can copy/paste a line at a time into an > > interactive > > session when I'm trying to debug, but was wondering if there is any tool out > > there that

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Peter A.Schott
nteractive window, X is defined, Y and Z are not. That's more the behaviour I was hoping for - the ability to run parts of my code at a time in order to work through issues without too much trouble in mostly-working code. TIA, -Pete Schott Mike Meyer <[EMAIL PROTECTED]> wrote: &g

Re: how to start a process and get it's pid?

2005-11-11 Thread Peter Hansen
ssId(handle) will do the trick (the second item returned is the PID), but I'm fairly sure there's a simpler approach if you keep looking. I recall there being a Cookbook recipe related to this too -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: directory listing

2005-11-11 Thread Peter Hansen
x27;c:\TEMP' as shown above, or directory='c:\temp' ? If you used the lower case version, you are not really checking the temp directory, since \t represents a TAB character. If that's the case, try using a forward slash instead: c:/temp . -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: weird problem with os.chmod

2005-11-11 Thread Peter Hansen
Mike Meyer wrote: > Strange that int doesn't recognize the leading 0. But you can use the > second argument to int: > >>>>int("0600", 16) > > 1536 You can use it another way too: >>> int('0600', 0) 384 >>> int('0x180

Re: [ x for x in xrange(10) when p(x) ]

2005-11-11 Thread Peter Otten
ined it to me when Bengt came up with this trick. http://mail.python.org/pipermail/python-list/2005-April/274051.html Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: What do you use as symbols for Python ?

2005-11-11 Thread Peter Otten
friends = Enum("Eric", "Kyle", "Stan", "Kenny") if "Kyle" in friends: print "Hi Kyle" print "My friends:", ", ".join(friends) Only Stan and Kenny show up in the last print statement because the containment test did not iterate over all friends. Also, Type.__name seems redundant. Just class Type(str): pass should do the job. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: SciPy python 2.4 wintel binaries

2005-11-12 Thread Peter Maas
jelle schrieb: > I dearly miss having the power of SciPy on my python 2.4 installation. > The topic of SciPy python 2.4 wintel binaries has been discussed before > on this list, but I haven't been able to find a compiled binary. If you really need SciPy, you should install Python 2.3 (Enthought Ed

Re: multiple inharitance super() question

2005-11-14 Thread Peter Otten
f __name__ == "__main__": B(42) The most significant constraint of that layout is that all __init__() methods need compatible signatures. Of course explicit invocation of baseclass initializers will continue to work... Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: simulating #include in python

2005-11-15 Thread Peter Otten
Nick Craig-Wood wrote: > I'd really like to be able to run an __import__ in the context of the file > thats running the include() but I haven't figured that out. execfile()? Peter -- http://mail.python.org/mailman/listinfo/python-list

initialising a list of lists

2005-11-16 Thread Peter Kleiweg
range(6)] >>> b[3].append('X') >>> b [[], [], [], ['X'], [], []] The first is clear and wrong. The second is hairy and right. Is there a way to do it clear and right? -- Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia) info: http://www.let.rug.nl/~kleiweg/ls.html -- http://mail.python.org/mailman/listinfo/python-list

Re: initialising a list of lists

2005-11-16 Thread Peter Kleiweg
Fredrik Lundh schreef op de 16e dag van de slachtmaand van het jaar 2005: > Peter Kleiweg wrote: > > > This does not what I want it to do: > > > >>>> a = [[]] * 6 > >>>> a[3].append('X') > >>>> a > &

Quitting a Tkinter application with confirmation

2005-11-16 Thread Peter Kleiweg
else: if tkMessageBox.askyesno(_('Quit'), _('Project is not saved. Ignore changes and quit?')): root.quit() class myTk(Tk): def destroy(self): quit() root = myTk() -- Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia) info: htt

Python driver for lpsolve

2005-11-16 Thread Peter Notebaert
lp_solve is a Mixed Integer Linear Programming (MILP) solver (see http://lpsolve.sourceforge.net/5.5/). There is now a Python driver to lpsolve. See http://lpsolve.sourceforge.net/5.5/Python.htm for more information about this driver. Peter -- http://mail.python.org/mailman/listinfo

Re: Quitting a Tkinter application with confirmation

2005-11-16 Thread Peter Kleiweg
Fredrik Lundh schreef op de 16e dag van de slachtmaand van het jaar 2005: > Peter Kleiweg wrote: > > > I want the program to behave identical if the 'close' button of > > the application window is clicked. I tried the code below, > > using a class derived

Re: Zope vs Php

2005-11-17 Thread Peter Maas
Templates. Most web frameworks have Templates. My favorite is Cheetah. -- --- Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0 E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')

Re: searching for files on Windows with Python

2005-11-17 Thread Peter Hansen
s recommendation here): since there is nothing else of interest in the "path" module, it seems to be a fairly common idiom to do "from path import path" and skip the doubled "path.path" bit. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: .pth - howto?

2005-11-17 Thread Peter Hansen
d some print statements at key points to see what it's doing. (Note that your first example above definitely wouldn't work, since that is the syntax for a string in Python source, whereas the relevant function [i.e. addpackage()] is merely reading lines from a file...) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Default method arguments

2005-11-18 Thread Peter Otten
bar.i += 1 ... re ... >>> >>> def foo(n): ... def bar(i): ... bar.s += i ... return bar.s ... bar.s = n ... return bar ... >>> a1 = foo(0) >>> a2 = foo(0) >>> a1(0), a2(0) (0, 0) >>> a1(1), a2(1) (1, 1) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Yield in a wrapper function

2005-11-18 Thread Peter Otten
test case. Something like for s in wrapper(1): print s, seems to work like you described because the text is buffered until the line is complete. Try for s in wrapper(1): print s or import sys for s in wrapper(1): print s, sys.stdout.flush() # explicitly flush the buffer instead. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding through recursion

2005-11-18 Thread Peter Tillotson
basically the other two points :-) you create a string of add functions add(2,4)--add(1,5)--add(0,6) only in the last ( add(0,6) ) explicitly returns y, in the else of add(1,5) you ignor it. If you want the starting add to return something sensible you need to find a way to pass it back up the

Re: How to do "new_variable = (variable) ? True : False; " (php) on python?

2005-11-18 Thread Peter Otten
Daniel Crespo wrote: > How can I do > > new_variable = (variable) ? True : False; > > in Python in one line? new_variable = variable :-) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Peter Otten
;: TernaryOperation(quantity>90,True,False)} By the time it compiles it will do the same as a = {"Huge": quantity>90} Consider describing your actual problem and keep in mind that the "ternary operator" is a means, not an end. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: func(*params)

2005-11-18 Thread Peter Otten
David Duerrenmatt wrote: > For some reasons, I've to use Python 1.5.2 and am looking for a > workaround: > > In newer Python versions, I can call a function this way: > > func = some_function > func(*params) Use apply(func, params) Peter -- http://mail.python.o

Re: textwrap.dedent() drops tabs - bug or feature?

2005-11-18 Thread Peter Hansen
will be expanded to spaces using the expandtabs() method of text. """ (This is not to say a specific rewording of the docs to lessen any confusion in this area wouldn't be welcomed.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: path module / class

2005-11-18 Thread Peter Hansen
o's mind? I suspect it's more realistic to think, as with the ternary operator, that he either will or won't, and examples proposed from outside won't have much if any impact on his thinking. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: need help about time.sleep, timer

2005-11-18 Thread Peter Hansen
r a description of a problem you are having with your current approach. Do you *want* it to wait forever if you don't enter anthing? -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-19 Thread Peter Hansen
he language more like Perl perhaps?). Or maybe one should instead interpret this as "numeric literals need more bells and whistles, and I don't care which of these two we add, but we have to do *something*!". :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a function access its own name?

2005-11-19 Thread Peter Hansen
e', 'co_varnames'] >>> x.f_code.co_name 'f' So your function could be: >>> import sys >>> def cap(): ... print 'function name is', sys._getframe().f_code.co_name ... >>> cap() function name is cap -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: textwrap.dedent() drops tabs - bug or feature?

2005-11-19 Thread Peter Hansen
as nothing to do with the expand_tabs attribute I pointed out. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-19 Thread Peter Hansen
microseconds per day), or write a nice little variant on int() that can do exactly what you would have done for the external data file if you had more values. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: path module / class

2005-11-19 Thread Peter Hansen
r for newcomers to the language (other than those who work with me), though for people who do feel that need I definitely promote the idea of path.py becoming standard.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: about dictionary

2005-11-20 Thread Peter Otten
n the dictionary b > simultaneously? > that is, > b={3:[],5:[],8:[],0:[]} > Thanks! > > > Other solution: > b.fromkeys(a,[]) Be warned that all keys share the same value. >>> a = [3, 5, 8, 0] >>> b = dict.fromkeys(a, []) >>> b[3].append(42) &

Re: about dictionary

2005-11-20 Thread Peter Otten
Shi Mu wrote: > how to do with it? Use Ben Finney's, not Przemek's approach if the values are mutables that you plan to modify. If that's what you are asking. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: about polygon

2005-11-20 Thread Peter Otten
he color explicitly (use "" to denote transparency): c.create_polygon(60,60,100,60,100,100,60,120, fill="", outline="black") I don't know why that isn't the default. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-20 Thread Peter Hansen
t("1234 5678 9012 3456 789".replace(' ','')) Or make a little function that does the same job and looks cleaner, if you need this more than once. But why would anyone want to create numeric literals for credit card numbers? -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-20 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Peter Hansen wrote: > >>But why would anyone want to create numeric literals for credit card >>numbers? >> > May be for space saving ? But storage space being so cheap, this is not > a very good reason, but still a reason. Space saving

Re: path module / class

2005-11-20 Thread Peter Hansen
ranted. I guess this is the same as in any other case of deprecation (e.g. some people still have to work with code that uses apply() or string module methods). > Peter Hansen: >> We've mandated use of path.py internally for all projects because >> we've noticed (esp

Re: Why are there no ordered dictionaries?

2005-11-20 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Using the same logic, we don't need types other than string in a DBMS > as we can always convert a string field into some other types when it > is needed. You mean, like SQLite does? (http://www.sqlite.org/datatypes.html) -Peter -- http://mail.pyth

Re: Numeric array in unittest problem

2005-11-21 Thread Peter Hansen
; b = Numeric.array([1,33]) > self.assertEqual(a, b) > pass > > > This will not raise any error ??? Code that doesn't execute at all generally raises no errors... -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric array in unittest problem

2005-11-21 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Sorry Peter, > Try this > > import unittest > import Numeric > > class myTest(unittest.TestCase): > def runTest(self): > var1 = Numeric.array([1,22]) > var2 = Numeric.array([1,33]) > self.assert

Re: Command line

2005-11-21 Thread Peter Hansen
here. http://docs.python.org/modindex.html -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a flat list to a list of tuples

2005-11-23 Thread Peter Otten
),chain(i,repeat(None))) Here's some more: >>> it = iter(range(5)) >>> map(None, it, it) [(0, 1), (2, 3), (4, None)] >>> N = 3 >>> it = chain(range(10), repeat("MISSING", N-1)) >>> zip(*(it,)*N) [(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 'MISSING', 'MISSING')] Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: sort the list

2005-11-23 Thread Peter Otten
ample [4, 1] and [4, 2] both have the same key. Therefore [4, 1] should stay before [4, 2], so the second is the "right" answer. The practical advantage is that if e. g. you sort items first by color and then by size, items of the same size will appear sorted by color. In particular, sorting a list by the same key a second time does not change the list. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a flat list to a list of tuples

2005-11-23 Thread Peter Otten
pecifying zip() behaviour in a way that allows the zip(it, it) trick worse than those you want to prevent? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: best cumulative sum

2005-11-23 Thread Peter Otten
s your implementation work for functions with f(a, b) != f(b, a)? + won't users be surprised that cumreduce(f, [1]) == cumreduce(f, [], 1) != cumreduce(f, [0]) == cumreduce(f, [], 0) Of course nothing can beat a plain old for loop in terms of readability and -- most likely -- speed. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: best cumulative sum

2005-11-23 Thread Peter Otten
n []: ... yield item ... >>> bool(empty()) True >>> bool(iter([])) True # python 2.3 and probably 2.5 >>> bool(iter([])) False # python 2.4 > yield init > for item in iterable: > init = func(init, item) > yield init Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: single process instance

2005-11-23 Thread Peter Hansen
rocess+instance In short, there is not a single function that does this, but depending on your needs there are a variety of approaches possible. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
This property is almost certainly used in some code, so it can't be broken without good reason. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Peter Hansen wrote: >>I believe it's currently guaranteed that the order of >>the items in dict.keys() and dict.values() will match (i.e. the index of >>any key in its list will be the same as the index of the corresponding >>value in it

Re: wxPython Licence vs GPL

2005-11-23 Thread Peter Hansen
"free" Opera** because they aren't "free" for me, loaded with advertisements that flash in my face and distract me all the time. I'm just highlighting how discussions of this nature which spend a lot of time revolving around narrow and non-shared definitio

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
eature could be undone now that code exists (we can assume) which is dependent on it. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
mentioned guarantee. My responsibility ended there, and with that I am outta here. :-) -Peter (And don't worry, I didn't take it as a challenge. If you thought I took offense somewhere, please re-read my words without that thought in mind and I think you'll see merely straight-forwa

Re: best cumulative sum

2005-11-24 Thread Peter Otten
Alan aka David Isaac wrote: > "Peter Otten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> You are in for a surprise here: > > You got that right! > >> >>> def empty(): >> ... for item in []: >> ...

Re: wxPython Licence vs GPL

2005-11-24 Thread Peter Hansen
gullible?) users in their ability to use it without being sued is being eroded by crafty negative marketing by Microsoft and others. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-24 Thread Peter Hansen
nt, even if not the one you thought it was. ;-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-24 Thread Peter Hansen
Fredrik Lundh wrote: > Steve Holden wrote: > >>sepcifications > > did you mean: sceptifications ? > > (otoh, with 11,100 google hits, "sepcifications" should probably be > considered as a fully acceptable alternate spelling ;-) Not if they're all in pages at site:holdenweb.com ! -- http://m

Re: Guification of console app

2005-11-24 Thread Peter Hansen
for asking is that the specifics of your answer will make it easier to describe how to modify this "console" so that the relevant parts work equally well as a _real_ console app (no GUI) or with the GUI. We could describe it in more general terms, but it might not be apparent how to adapt that to your own case. -Peter -- http://mail.python.org/mailman/listinfo/python-list

How to get started in GUI Programming?

2005-11-25 Thread peter . mosley
I am trying to learn GUI programming in Python, but have to confess I am finding it difficult. I am not an experienced programmer - just someone who from time to time writes small programs for my use. Over the years I have moved from GWBASIC to QBASIC to Visual Basic, and now trying to move acros

Re: How to get started in GUI Programming?

2005-11-25 Thread Peter Decker
On 11/25/05, Sybren Stuvel <[EMAIL PROTECTED]> > I'd go for wxPython ;-) I'd go for Dabo, which is a Pythonic wrapper around wxPython. They are even working on a visual design tool to lay out your UI, much as you would in Visual Basic. -- # p.d. -- http://mail.python.org/mailman/listinfo/pytho

Re: Writing pins to the RS232

2005-11-25 Thread Peter Hansen
ws the file win32serial.py (or something like that... going by memory) is what will be used, not the java one. Also, pyparallel should let you get closer to what you want, and in fact questions about using it are certainly on-topic here, though troubleshooting hardware issues are probably not. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: best cumulative sum

2005-11-26 Thread Peter Otten
David Isaac wrote: > "Peter Otten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I'd rather have a second look whether the test is really needed. > > That's too obscure of a hint. > Can you be a bit more explicit? > Here'

Re: Whitespace test after string.split

2005-11-26 Thread Peter Otten
gt;> [t.strip() for t in s.split(",") if t and not t.isspace()] ['alpha', 'gamma', 'delta'] There you are. > As a second question, I am seeing string split as deprecated in 2.4.2 > manual. What is planned in future to split (strings or unicode)? Just use the corresponding methods, e. g. s.strip() instead of string.strip(s) etc. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison problem

2005-11-26 Thread Peter Hansen
item[0] will fail if the string is empty, while item[0:1] will return '' in that case. Of course, as you point out, .startswith() is the better approach anyway. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison problem

2005-11-26 Thread Peter Hansen
Tom Anderson wrote: > On Sat, 26 Nov 2005, Peter Hansen wrote: >>Tom Anderson wrote: >>>On Sat, 26 Nov 2005, Chris wrote: >>>> if item[0:1]=="-": >>> >>>item[0:1] seems a rather baroque way of writing item[0]! I'd actually >>

Re: best cumulative sum

2005-11-27 Thread Peter Otten
David Isaac wrote: > "Peter Otten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I think that the test for an empty iterator makes ireduce() unintuitive. > > OK. > I misunderstood you point. > But that is needed to match the behavior o

Re: Syntax

2005-11-27 Thread Peter Hansen
quot; still have the old objects, not the new ones. Using "import module" and referencing things with "module.name" doesn't suffer from the same potential for problems (in addition to it being more readable etc). -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison problem

2005-11-27 Thread Peter Hansen
Fredrik Lundh wrote: > Peter Hansen wrote: >>Actually, it's not so much baroque as it is safe... item[0] will fail if >>the string is empty, while item[0:1] will return '' in that case. >> >>Of course, as you point out, .startswith() is the better approa

Re: General question about Python design goals

2005-11-27 Thread Peter Hansen
y, of course, is that there would be other gaps, and they would be more practical ones, so other people would probably be suggesting things like "wouldn't it be good if Python had a Unicode type instead of all these little-used functions that make the language nice and orthogonal but are

Re: best cumulative sum

2005-11-28 Thread Peter Otten
re is only one initializer in reduce. Throw in a if len(init) > 1: raise TypeError for increased similarity to reduce(). > Also it is possible to not provide it. Try it. Peter PS: Did I mention that I prefer for-loops over reduce() most of the time? -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison problem

2005-11-28 Thread Peter Hansen
Tim Henderson wrote: > peter (Thanks for clarifying to whom you were responding... I saw the other post but wouldn't have responded since it didn't seem to be in response to one of mine. :-) ) > would not the more correct way to do this be short circuit > evaluation. somt

Re: Death to tuples!

2005-11-28 Thread Peter Hansen
29 LOAD_CONST 4 (5) 32 LOAD_CONST 5 (7) 35 LOAD_CONST 6 (8) 38 BUILD_LIST 5 41 COMPARE_OP 6 (in) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing pins to the RS232

2005-11-28 Thread Peter Hansen
variations from 6V up to 13V seen in the wild), and without much in the way of drive capability. Using this to control custom hardware would probably be an exercise in frustration and kind of pointless in comparison to using parallel hardware, which at least has more typical logic voltage level

Re: How to get started in GUI Programming?

2005-11-28 Thread peter . mosley
A big thank you to all who responded. There are too many to reply individually, but to summarise ... Thomas Güttler gave a link to an example program, editMetadata.py which uses yes no dialogs and scaled images. I've not yet tried to learn from this, but looking at the code it seems to provide e

Re: General question about Python design goals

2005-11-28 Thread Peter Hansen
ch for searching - a genius surveys the chaos"). Is that really the translation? "too lazy to search for searching"? What does that mean? Google translate doesn't help... here's it's rather comical attempt: "Who order holds is only to putrid for looking for -

Re: Death to tuples!

2005-11-28 Thread Peter Hansen
Antoon Pardon wrote: > Op 2005-11-28, Peter Hansen schreef <[EMAIL PROTECTED]>: >>Mike Meyer wrote: >>>Is there any place in the language that still requires tuples instead >>>of sequences, except for use as dictionary keys? >> >>Would it be possi

Re: nesting for statements?

2005-11-29 Thread Peter Otten
c 3 aa 4 ab 5 ac 6 ba 7 bb 8 bc 9 ca 10 cb 11 cc 12 aaa 13 aab 14 aac 15 aba 16 abb 17 abc 18 aca 19 acb That said, reading the tutorial or an introductory book on Python never hurts... Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why I need to declare import as global in function

2005-11-29 Thread Peter Otten
namespace f() execfile() puts symbols into the local namespace but keeps the compiler clueless because it's just an ordinary function, whereas exec triggers the generation of slightly different bytecode for the enclosing function. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why I need to declare import as global in function

2005-11-29 Thread Peter Otten
Duncan Booth wrote: > Isn't it fun trying to guess the problem in the absence of the code? What other reason could there be to forego the sane approach -- stick 'import math' everywhere it might belong? Those exec/execfile() peculiarities are so much more interesting ;-

Re: wxPython : getting started

2005-11-29 Thread Peter Milliken
the MegaWidget, MegaArchetype etc. Having said that, I still have my printer utility (Win32) written using wxPython - I never could work out how to get that working with Pmw/TkInter. I just used sockets to transfer the text to be printed between the wxPython print utility and my TkInter/Pmw based applica

Re: python speed

2005-11-30 Thread Peter Hansen
re umm... somehow.. not "pure"...?). Judging by the other posts in this thread, the gauntlet is down: Python is faster than Java. Let those who believe otherwise prove their point with facts, and without artificially handcuffing their opponents with non-real-world "purity" requirements. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Quene

2005-11-30 Thread Peter Hansen
will pop an item off the front of the list, which is the end opposite where .append() puts them. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: python speed

2005-11-30 Thread Peter Hansen
Isaac Gouy wrote: > Peter Hansen wrote: >>Judging by the other posts in this thread, the gauntlet is down: Python >>is faster than Java. Let those who believe otherwise prove their point >>with facts, and without artificially handcuffing their opponents with >>non-real-

Re: python speed

2005-11-30 Thread Peter Hansen
Donn Cave wrote: > I read yesterday morning in the paper that the Goto Basic Linear > Algebra Subroutines, by a Mr. Kazushige Goto, are still the most > efficient library of functions for their purpose for use in > supercomputing applications. Apparently hand-optimized assembler > for specific pro

Re: How to list currently defined classes, methods etc

2005-11-30 Thread Peter Hansen
Deep wrote: > If i start a python shell. Is there a way to list the currently defined > classes, methods, > variables? Does this work? >>> dir() -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Python & Serial Port question

2005-11-30 Thread Peter Hansen
x27;win32': from serialwin32 import * elif os.name == 'posix': from serialposix import * elif os.name == 'java': from serialjava import * so the java stuff will not be used on regular Python under "nt" (Windows) or Linux. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Database Module in a Web Application

2005-12-01 Thread Peter Hansen
as already done the work for you. All databases which you would probably want to use for this already have Python wrappers which will do the job. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieve input

2005-12-01 Thread Peter Hansen
a... but the server isn't sending anything at this point, so the call to _sock.recv() blocks indefinitely. Troubleshooting further would require details you haven't provided, such as what URL is requested, what the server is, etc... -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHTTPServer module

2005-12-01 Thread Peter Hansen
like .read() or maybe .readline() and others. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI module does not parse data

2005-12-01 Thread Peter Hansen
ticular feature is not perfect, as opposed to "crashes and burns" or "does nothing at all"... Also, someone who has it "working" on a Mac hasn't necessarily tried out the entire range of functionality so the thing you read might still be correct. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Instances behaviour

2005-12-02 Thread Peter Otten
ypically raised once during the development process while my approach bites (only) the illiterate programmer with a message like >>> a.foo() Traceback (most recent call last): File "", line 1, in ? AttributeError: 'A' object has no attribute 'foo' which normally can be tracked down almost as quickly -- and which serves him well anyway :-) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Instances behaviour

2005-12-02 Thread Peter Otten
mplest solution is most likely the most pythonic, even when some odd corner cases are not covered. Simplicity also has a nice side effect: fewer bugs. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: EOF error

2005-12-03 Thread Peter Otten
;)) > EOFError > > what is the reason? how do i overcome this? > Thanks in advance for you valuable time You have to open your file in binary mode for both dumping and loading the data. For that just add a "b" to the mode parameter, e. g. file("ques.dat", "rb"). Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute an EXE via os.system() with spaces in the directory name?

2005-12-03 Thread Peter Hansen
double initial quotation mark is required. Either way, "brain damage" definitely describes it. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble with idle from python 2.4.2 on SUSE linux 9.3

2005-12-04 Thread Peter Otten
my system; can anybody provide me with > some advice? I think you need to install the tcl-devel and tk-devel packages, too. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Colorize expanded tabs

2005-12-04 Thread Peter Otten
=8): parts = splititer(text, "\t") part = parts.next() pos = len(part) yield part for part in parts: width = tabwidth - pos % tabwidth yield tabcolor yield " " * width yield normcolor yield part pos += width + len(part)

<    17   18   19   20   21   22   23   24   25   26   >