Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Peter Otten
Philippe C. Martin wrote: > Any clue would be quite welcome. I didn't recognize the pattern in the code you posted, but sometimes the order of imports matters: $ find . . ./package ./package/beta.py ./package/alpha.py ./package/__init__.py $ python Python 2.3.3 (#1, Feb 5 2005, 16:22:10) [GCC 3

Re: noob question

2005-06-25 Thread Devan L
To recognize variables that you have assigned, just look for assignment. If your code is readible, and you know it well, you shouldn't need the $ sign in front of everything. -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-25 Thread Peter Otten
Steven D'Aprano wrote: > On Sat, 25 Jun 2005 21:30:26 +0200, Peter Otten wrote: > >> Mandus wrote: >> >>> By using the builtin reduce, I >>> move the for-loop into the c-code which performs better. >> >> No. There is no hope of ever writing fast code when you do not actually >> measure its perf

Re: Thoughts on Guido's ITC audio interview

2005-06-25 Thread John Roth
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 25 Jun 2005 19:31:20 -0600, John Roth wrote: > >> >> "Dave Benjamin" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Guido gave a good, long interview, available at IT Conversations, as was >

Re: Life of Python

2005-06-25 Thread Chris Lambacher
On the accessor function topic. Here is a good description of why you don't need accessors in python (among other things) written by the main PEAK(http://peak.telecommunity.com/) developer (Phillip J. Eby): http://dirtsimple.org/2004/12/python-is-not-java.html Some other useful articles in a simi

Re: Thoughts on Guido's ITC audio interview

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 19:31:20 -0600, John Roth wrote: > > "Dave Benjamin" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Guido gave a good, long interview, available at IT Conversations, as was >> recently announced by Dr. Dobb's Python-URL! The audio clips are available > > [s

Re: noob question

2005-06-25 Thread Björn Lindström
Matt Hollingsworth <[EMAIL PROTECTED]> writes: > What are some good options that people commonly use so that they can > easily and quickly identify variable with just a glance? Use an editor that has a Python syntax highlighting mode, for example Emacs with python-mode, Vim, or the IDLE IDE that

noob question

2005-06-25 Thread Matt Hollingsworth
Hello, Very new to python, so a noob question. When I've written stuff in JavaScript or MEL in the past, I've always adopted the variable naming convention of using a $ as the first character (no, I don't use perl, never have). Not possible in python. What are some good options that people

Re: Thoughts on Guido's ITC audio interview

2005-06-25 Thread D H
Dave Benjamin wrote: > One thing Guido mentions in his comparison of ABC (Python's predecessor) and > Python is how ABC was inextricably tied to its environment (a la Smalltalk), What surprised me was that this was the only thing he really mentioned. He didn't mention anything about the the

Re: OO approach to decision sequence?

2005-06-25 Thread Bengt Richter
On Sat, 18 Jun 2005 03:52:28 -0400, Brian van den Broek <[EMAIL PROTECTED]> wrote: [...] > >Now, the same sort of behaviour where the "if type" testing has been >replaced with code more in keeping with the OOP approach: > > >>> class C(object): >...def report(self): >...print "Fou

Rebindings [was Re: Favorite non-python language trick?]

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 23:08:10 +, Bengt Richter wrote: >>Using := and = for assignment and equality is precisely as stupid as using >>= and == for assignment and equality. Perhaps less stupid: why do we use >>== for equals, but not ++ for plus and -- for minus? >> > I agree, but I think := would

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 23:08:10 +, Bengt Richter wrote: > On Sun, 26 Jun 2005 04:08:31 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >>On Fri, 24 Jun 2005 15:47:45 -0700, James Stroud wrote: >> >>> On Friday 24 June 2005 05:58 am, Steven D'Aprano wrote: with colour do begin red :

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 18:44:12 -0700, James Stroud wrote: > On Saturday 25 June 2005 11:08 am, Steven D'Aprano wrote: >> The problem is, you have made colour (returning to English spelling >> instead of foreign) into a class. If you need two colour variables, you >> have to duplicate the code for th

Re: Favorite non-python language trick?

2005-06-25 Thread James Stroud
On Saturday 25 June 2005 06:44 pm, James Stroud wrote: > I thought they were > pointless 18 years ago when I learned pascal in highschool and after 20 > years, I still think they are still pointless. I think that fails "==". -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 9515

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 23:19:48 +0200, Peter Otten wrote: > Python is more about readability than raw speed, and I prefer a for-loop > over reduce() in that respect, too. Fascinating. I prefer reduce for readability. "Reduce this list to one value, using this known behaviour" seems to work for me b

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 13:31:19 -0700, Robert Kern wrote: > Of course, in a Python 3000 world, nothing stops anyone from using their > own extension module implementing map, filter, and reduce if they really > want to. TSBOOOWTDI in the language/stdlib, but it shouldn't stop anyone > from using ot

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 21:30:26 +0200, Peter Otten wrote: > Mandus wrote: > >> By using the builtin reduce, I >> move the for-loop into the c-code which performs better. > > No. There is no hope of ever writing fast code when you do not actually > measure its performance. Good grief! You've been

Re: Favorite non-python language trick?

2005-06-25 Thread James Stroud
On Saturday 25 June 2005 11:08 am, Steven D'Aprano wrote: > The problem is, you have made colour (returning to English spelling > instead of foreign) into a class. If you need two colour variables, you > have to duplicate the code for the class (perhaps only changing the > numeric constants. You

Re: A strange and annoying restriction, possibly a bug. A glance by amore experienced would be nice.

2005-06-25 Thread Terry Reedy
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Elmo Mäntynen" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > n=(100,) tuple(*n) > > As posted, this gives a syntax error. What is missing? Actually, I should have said 'as received'. -- htt

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 15:44:14 -0400, Nicolas Fleury wrote: > Steven D'Aprano wrote: >> One of the things I liked in Pascal was the "with" keyword. You could >> write something like this: >> >> with colour do begin >> red := 0; blue := 255; green := 0; >> end; >> >> instead of: >> >> colour.red :

Re: Thoughts on Guido's ITC audio interview

2005-06-25 Thread John Roth
"Dave Benjamin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Guido gave a good, long interview, available at IT Conversations, as was > recently announced by Dr. Dobb's Python-URL! The audio clips are available [snip] > - Java: the usual static vs. dynamic, static analysis vs.

Re: Favorite non-python language trick?

2005-06-25 Thread Terry Reedy
"Mandus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fri, 24 Jun 2005 16:31:08 +0100 skrev Tom Anderson: >> On Fri, 24 Jun 2005, Joseph Garvin wrote: >> Higher-order functions like map, filter and reduce. As of Python 3000, >> they're non-python tricks. Sigh - i guess it's time

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 19:23:18 +, Mandus wrote: > Sat, 25 Jun 2005 16:06:57 GMT skrev Lee Harr: Higher-order functions like map, filter and reduce. As of Python 3000, they're non-python tricks. Sigh - i guess it's time for me to get to know list comprehensions a bit better.

Re: A strange and annoying restriction, possibly a bug. A glance by amore experienced would be nice.

2005-06-25 Thread Terry Reedy
"Elmo Mäntynen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] n=(100,) tuple(*n) As posted, this gives a syntax error. What is missing? tjr -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble subclassing str

2005-06-25 Thread Bengt Richter
On 23 Jun 2005 21:27:20 -0700, "Paul McGuire" <[EMAIL PROTECTED]> wrote: >Dang, that class should be: > >class PaddedStr(str): >def __new__(cls,s,l,padc=' '): >if l > len(s): >s2 = "%s%s" % (s,padc*(l-len(s))) >return str.__new__(cls,s2) >else: >

Thoughts on Guido's ITC audio interview

2005-06-25 Thread Dave Benjamin
Guido gave a good, long interview, available at IT Conversations, as was recently announced by Dr. Dobb's Python-URL! The audio clips are available here: http://www.itconversations.com/shows/detail545.html http://www.itconversations.com/shows/detail559.html I'd like to comment on a few parts of

Re: Favorite non-python language trick?

2005-06-25 Thread Bengt Richter
On Sun, 26 Jun 2005 04:08:31 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Fri, 24 Jun 2005 15:47:45 -0700, James Stroud wrote: > >> On Friday 24 June 2005 05:58 am, Steven D'Aprano wrote: >>> with colour do begin >>> red := 0; blue := 255; green := 0; >>> end; >>> >>> instead of: >>> >>>

python-dev Summary for 2005-06-01 through 2005-06-15

2005-06-25 Thread Steven Bethard
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-06-01_2005-06-15.html] = Summary Announcements = - Bug Day: Saturday, June 25th 2005 - AMK organized an

python-dev Summary for 2005-05-16 through 2005-05-31

2005-06-25 Thread Steven Bethard
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-05-16_2005-05-31.html] = Summary Announcements = QOTF We have our first ever Quote of the Fortnight (QOTF), thanks to the wave of discussion over `PEP 343`_

python-dev Summary for 2005-05-01 through 2005-05-15

2005-06-25 Thread Steven Bethard
[The HTML version of this Summary is available at http://www.python.org/dev/summary/2005-05-01_2005-05-15.html] = Summary Announcements = -- PEP 340 Episode 2: Revenge of the With (Block) -

Re: A strange and annoying restriction, possibly a bug. A glance by a more experienced would be nice.

2005-06-25 Thread D H
Elmo Mäntynen wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > This is the case: > > n=(100,) tuple(*n) > > > Traceback (most recent call last): > File "", line 1, in -toplevel- > tuple(*n) > TypeError: iteration over non-sequence The star (*n) means you are essentially

Re: A strange and annoying restriction, possibly a bug. A glance by a more experienced would be nice.

2005-06-25 Thread Robert Kern
Elmo Mäntynen wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > This is the case: > > n=(100,) tuple(*n) > > > Traceback (most recent call last): > File "", line 1, in -toplevel- > tuple(*n) > TypeError: iteration over non-sequence n is a sequence. *n correctly expands. T

A strange and annoying restriction, possibly a bug. A glance by a more experienced would be nice.

2005-06-25 Thread Elmo Mäntynen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is the case: >>> n=(100,) tuple(*n) Traceback (most recent call last): File "", line 1, in -toplevel- tuple(*n) TypeError: iteration over non-sequence To be sure I searched for ways to check if something is a sequence: >>> n.__iter__().n

Re: Office COM automatisation - calling python from VBA

2005-06-25 Thread Johan Lindberg
Hi. > > If you are new to Python and want to use it with COM, definitely get > > yourself a copy of _Python Programming on Win32_ by Mark Hammond and > > Andy Robinson. > > ...or at least read the chapter available online: > http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html Also, check

Re: Favorite non-python language trick?

2005-06-25 Thread Peter Otten
Mandus wrote: > 25 Jun 2005 13:15:16 -0700 skrev Devan L: >> But by using the builtin reduce, you need to specify a function, which >> probably slows it down more than any speed-up from the loop in C. > > Sounds reasonable, but not always the case, especially when dealing with > numpy arrays. At

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Peter Otten
Philippe C. Martin wrote: > OK Peter, first of all thanks. > > You seem to be German and although I leave in the states, I'm French and > your english is clearly far more advanced than mine: I have yet to > understand a few of your comments ;-) My French is mostly read-only, so let me rephrase:

Re: Excellent Site for Developers

2005-06-25 Thread Chinook
On Sat, 25 Jun 2005 15:36:06 -0400, Philippe C. Martin wrote (in article <[EMAIL PROTECTED]>): > Hi, > > Not being from anglo-saxon heritage, I keep wondering why spammers always > (or very often) get called 'trolls' ? > > I mean fantasy fiction has brought us many hugly beasts (goblin, warlock,

Re: Favorite non-python language trick?

2005-06-25 Thread Robert Kern
Devan L wrote: > But by using the builtin reduce, you need to specify a function, which > probably slows it down more than any speed-up from the loop in C. Not if the function is from an extension module. For some applications, this can be quite common. Of course, in a Python 3000 world, nothing

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
I meant live, not leave ! (this is getting pretty bad) Philippe C. Martin wrote: > OK Peter, first of all thanks. > > You seem to be German and although I leave in the states, I'm French and > your english is clearly far more advanced than mine: I have yet to > understand a few of your comments

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
25 Jun 2005 13:15:16 -0700 skrev Devan L: > But by using the builtin reduce, you need to specify a function, which > probably slows it down more than any speed-up from the loop in C. Sounds reasonable, but not always the case, especially when dealing with numpy arrays. At least that what some of m

Re: Favorite non-python language trick?

2005-06-25 Thread Devan L
But by using the builtin reduce, you need to specify a function, which probably slows it down more than any speed-up from the loop in C. -- http://mail.python.org/mailman/listinfo/python-list

Re: Excellent Site for Developers

2005-06-25 Thread Philippe C. Martin
Woof! And I thought my english was improving ! I'm laughing very hard right now, thanks ! Philippe Skip Montanaro wrote: > > Philippe> Not being from anglo-saxon heritage, I keep wondering why > Philippe> spammers always (or very often) get called 'trolls' ? > > Fishing from a boa

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
Sat, 25 Jun 2005 21:30:26 +0200 skrev Peter Otten: > Mandus wrote: > >> By using the builtin reduce, I >> move the for-loop into the c-code which performs better. > > No. There is no hope of ever writing fast code when you do not actually > measure its performance. I do. -- Mandus - the only man

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
OK Peter, first of all thanks. You seem to be German and although I leave in the states, I'm French and your english is clearly far more advanced than mine: I have yet to understand a few of your comments ;-) > Care to provide the traceback? Traceback (most recent call last): File "SC_Shell.py

Re: Excellent Site for Developers

2005-06-25 Thread Skip Montanaro
Philippe> Not being from anglo-saxon heritage, I keep wondering why Philippe> spammers always (or very often) get called 'trolls' ? Fishing from a boat that is moving slowly is called "trolling". You're slowly dragging bait or a lure through the water to entice a fish to bite your hook.

Re: Favorite non-python language trick?

2005-06-25 Thread Nicolas Fleury
Steven D'Aprano wrote: > One of the things I liked in Pascal was the "with" keyword. You could > write something like this: > > with colour do begin > red := 0; blue := 255; green := 0; > end; > > instead of: > > colour.red := 0; colour.blue := 255; colour.green := 0; > > Okay, so maybe it is m

Re: Excellent Site for Developers

2005-06-25 Thread Philippe C. Martin
Sorry, limbs (plus I check in a dictionnary first!) Philippe C. Martin wrote: > limns -- http://mail.python.org/mailman/listinfo/python-list

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Peter Otten
Philippe C. Martin wrote: > l = inspect.getmembers(eval('BC')) #THIS CRASHES - the class exists Care to provide the traceback? > In [23]:from SC.CARDS.BC import * > > In [24]:l = inspect.getmembers(eval('BC')) What happened in lines 1 through 22? My guess would be In [13]:from SC.CARDS import

Re: Excellent Site for Developers

2005-06-25 Thread Philippe C. Martin
Hi, Not being from anglo-saxon heritage, I keep wondering why spammers always (or very often) get called 'trolls' ? I mean fantasy fiction has brought us many hugly beasts (goblin, warlock, orc, dark elf ) The trolls, as I recall, grow back their limns once those have been cut by the nice fo

tkinter radiobutton

2005-06-25 Thread William Gill
I am placing radiobuttons in a 4 X 4 matrix (using loops) and keep references to them in a 2 dimensional list ( rBtns[r][c] ). It works fine, and I can even make it so only one button per column can be selected, by assigning each column to an intVar. In many languages a radiobutton has a prop

Re: Favorite non-python language trick?

2005-06-25 Thread Peter Otten
Mandus wrote: > By using the builtin reduce, I > move the for-loop into the c-code which performs better. No. There is no hope of ever writing fast code when you do not actually measure its performance. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How does one write a function that increments a number?

2005-06-25 Thread Mandus
Sun, 26 Jun 2005 04:14:19 +1000 skrev Steven D'Aprano: > On Fri, 24 Jun 2005 21:53:03 -0700, [EMAIL PROTECTED] wrote: > >> Apologies if this question seems stupid: How does one write a >> function that increments a value in Python? When I tried, the variable >> never changed. >> The session went

Re: Favorite non-python language trick?

2005-06-25 Thread Devan L
Why overload when you can use class methods? -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
Sat, 25 Jun 2005 16:06:57 GMT skrev Lee Harr: >>> Higher-order functions like map, filter and reduce. As of Python 3000, >>> they're non-python tricks. Sigh - i guess it's time for me to get to know >>> list comprehensions a bit better. >>> > > > Couldnt there just be a "functional" module ?... >

Re: Excellent Site for Developers

2005-06-25 Thread Brian van den Broek
Brian said unto the world upon 25/06/2005 10:50: > Do Re Mi chel La Si Do wrote: > >>rather... super troll > > > 100% Agreed. > > Can anyone say, "This looks like spam... Feels like spam... and is about > as useful here in the Python forums as spam -- therfore my conclusion is > that his

Re: Favorite non-python language trick?

2005-06-25 Thread Mandus
Sun, 26 Jun 2005 04:36:51 +1000 skrev Steven D'Aprano: > On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: > >> On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: >>> It is really a consensus on this; that >>> removing map, filter, reduce is a good thing? It will render a whole lot >>>

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, I found the solution to my problem: Besides the fact I still have no clue as to how the Python name spacing works, the code I though did stuff (the __EXEC_LIST loop) did not do as I expected as I had already imported all of the modules in an explicit manner. So now I can rephrase my problem:

Re: Favorite non-python language trick?

2005-06-25 Thread George Sakkis
"Konstantin Veretennicov" <[EMAIL PROTECTED]> wrote: > On 6/25/05, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: > > > > > On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: > > >> It is really a consensus on this; that > > >> removing

Re: Favorite non-python language trick?

2005-06-25 Thread Tom Anderson
On Sat, 25 Jun 2005, Konstantin Veretennicov wrote: > On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: > >> It is really a consensus on this; that removing map, filter, reduce is >> a good thing? It will render a whole lot of my software unusable :( > > I think you'll be able to use "from __past__ i

Re: Favorite non-python language trick?

2005-06-25 Thread Tom Anderson
On Fri, 24 Jun 2005, Roy Smith wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: > >> The one thing i really do miss is method overloading by parameter type. >> I used this all the time in java > > You do things like that in type-bondage languages I love that expression. I think it started out a

Re: Favorite non-python language trick?

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: > > > On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: > >> It is really a consensus on this; that > >> removing map, filter, reduce is a good thing? It will render a whole lot

Re: a dictionary from a list

2005-06-25 Thread George Sakkis
"Steven D'Aprano" wrote: > On Sat, 25 Jun 2005 06:44:22 -0700, George Sakkis wrote: > > > "Roy Smith" <[EMAIL PROTECTED]> wrote: > > > >> I just re-read the documentation on the dict() constructor. Why does it > >> support keyword arguments? > >> > >>dict(foo="bar", baz="blah") ==> {"foo":"ba

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: > On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: >> It is really a consensus on this; that >> removing map, filter, reduce is a good thing? It will render a whole lot >> of my software unusable :( > > I think you'll be able to use

Re: regex question

2005-06-25 Thread Paul McGuire
Here's a pyparsing version of this, that may be easier to maintain long term (although if you have your heart set on learning regexp's, they will certainly do the job). Note that in pyparsing, you don't have to spell out where the whitespace goes - pyparsing's default logic assumes that whitespace

Re: regex question

2005-06-25 Thread George Sakkis
"Felix Schwarz" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm experiencing problems with a regular expression and I can't figure > out which words I use when googling. I read the python documentation for > the re module multiple times now but still no idea what I'm doing wrong. > > What I want to d

Re: a dictionary from a list

2005-06-25 Thread Steven D'Aprano
On Sat, 25 Jun 2005 06:44:22 -0700, George Sakkis wrote: > "Roy Smith" <[EMAIL PROTECTED]> wrote: > >> I just re-read the documentation on the dict() constructor. Why does it >> support keyword arguments? >> >>dict(foo="bar", baz="blah") ==> {"foo":"bar", "baz"="blah"} >> >> This smacks of c

Re: Favorite non-python language trick?

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 24 Jun 2005 14:29:37 -0700, James wrote: > > 2.) Contracts > > Explain please. James probably meant Eiffel's Design by Contract. My favourite Python implementation is Terence Way's http://www.wayforward.net/pycontract/ ;-) - kv --

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, Hopefully to make things clearer: this works from a shell: In [23]:from SC.CARDS.BC import * In [24]:l = inspect.getmembers(eval('BC')) #l will get all members from class 'BC' whereas the code referenced below gets an exception saying 'BC' is not defined. Thanks, Philippe Philippe C.

Re: distutils: Every file doubled in binary distri

2005-06-25 Thread Torsten Bronger
Hallöchen! Ingrid Bronger <[EMAIL PROTECTED]> writes: > [...] > > Then I call "python setup.py bdist_dumb" on ym Linux box. The > resulting tar ball contains every file twice, e.g. > > ./usr/lib/python2.3/site-packages/my_package/my_module.py > ./usr/lib/python2.3/site-packages/my_module.py > >

Re: How does one write a function that increments a number?

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 21:53:03 -0700, [EMAIL PROTECTED] wrote: > Apologies if this question seems stupid: How does one write a > function that increments a value in Python? When I tried, the variable > never changed. > The session went like this: def incr(counter): > counter = int(count

Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, I'm getting pretty desperate here: The code below crashes on the last line (but works from a shell). The class 'BC' exists and the loop on self.__BC_EXEC_LIST passes fine. It's got to be something really stupid but I've been looking at it too long I guess. Any clue would be quite welcome.

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 15:47:45 -0700, James Stroud wrote: > On Friday 24 June 2005 05:58 am, Steven D'Aprano wrote: >> with colour do begin >> red := 0; blue := 255; green := 0; >> end; >> >> instead of: >> >> colour.red := 0; colour.blue := 255; colour.green := 0; >> >> Okay, so maybe it is more of

Re: Favorite non-python language trick?

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 14:29:37 -0700, James wrote: > Interesting thread ... > > 1.) Language support for ranges as in Ada/Pascal/Ruby > 1..10 rather than range(1, 10) What advantages do Pascal-like for loops give over Python for loops? The only two I can think of are trivial: (1) the Pascal-like

Re: Excellent Site for Developers

2005-06-25 Thread Charles Krug
On Sat, 25 Jun 2005 14:50:48 GMT, Brian <[EMAIL PROTECTED]> wrote: > Do Re Mi chel La Si Do wrote: >> rather... super troll > > 100% Agreed. > > Can anyone say, "This looks like spam... Feels like spam... and is about > as useful here in the Python forums as spam -- therfore my conclusion is

Re: what list comprehension can't

2005-06-25 Thread Steven D'Aprano
On Fri, 24 Jun 2005 21:04:15 +0200, Christophe Delord wrote: > Hello, > > On 24 Jun 2005 11:45:14 -0700, [EMAIL PROTECTED] wrote: > >> Hello, >> >> Can we impose if then else into list comprehension ? >> Like we do in lambda-map form: >> >> This code change None into 0 >> L = [None, 12] >> R =

distutils: Every file doubled in binary distri

2005-06-25 Thread Torsten Bronger
Hallöchen! I have a very simple package structure with one directory denoting a package (with __init__.py file of course). In my setup.py I write ... packages=['my_package'] ... Then I call "python setup.py bdist_dumb" on ym Linux box. The resulting tar ball contains every file twi

Re: a dictionary from a list

2005-06-25 Thread Scott David Daniels
Roy Smith wrote: > Terry Hancock <[EMAIL PROTECTED]> wrote: > ... > I just re-read the documentation on the dict() constructor. Why does it > support keyword arguments? > >dict(foo="bar", baz="blah") ==> {"foo":"bar", "baz"="blah"} > > This smacks of creeping featurism. Is this actually us

Re: Favorite non-python language trick?

2005-06-25 Thread Lee Harr
>> Higher-order functions like map, filter and reduce. As of Python 3000, >> they're non-python tricks. Sigh - i guess it's time for me to get to know >> list comprehensions a bit better. >> Couldnt there just be a "functional" module ?... from functional import map, filter, reduce -- http://

Re: BaseHTTPServer and priviledge separation?

2005-06-25 Thread Lee Harr
> to use a port below 1000 on a Unix system one needs root priviledges. > But it's dangerous to execute all of a script under those priviledges. > Therefore I'd like to drop the root priviledges as soon as possible. > (How) is this possible? > Are you sure you don't just want to use twisted? http

Re: Favorite non-python language trick?

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: > It is really a consensus on this; that > removing map, filter, reduce is a good thing? It will render a whole lot > of my software unusable :( I think you'll be able to use "from __past__ import map, filter, reduce" or something like that :) They don

BaseHTTPServer and priviledge separation?

2005-06-25 Thread Helmut Jarausch
Hi, to use a port below 1000 on a Unix system one needs root priviledges. But it's dangerous to execute all of a script under those priviledges. Therefore I'd like to drop the root priviledges as soon as possible. (How) is this possible? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Nu

Re: regex question

2005-06-25 Thread Helmut Jarausch
Felix Schwarz wrote: > Hi all, > > I'm experiencing problems with a regular expression and I can't figure > out which words I use when googling. I read the python documentation for > the re module multiple times now but still no idea what I'm doing wrong. > > What I want to do: > - Extract all

Re: super problem

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Uwe Mayer <[EMAIL PROTECTED]> wrote: > AFAIK super only works with new-style classes, so I checked: > > >>> from qtcanvas import * > >>> isinstance(QCanvasItem, object) > True AFAIK, this is not the right way to check for new-styledness: >>> class X: "i'm an old-styler" >>> isinstanc

regex question

2005-06-25 Thread Felix Schwarz
Hi all, I'm experiencing problems with a regular expression and I can't figure out which words I use when googling. I read the python documentation for the re module multiple times now but still no idea what I'm doing wrong. What I want to do: - Extract all digits (\d) in a string. - Digits are

Re: Excellent Site for Developers

2005-06-25 Thread Brian
Do Re Mi chel La Si Do wrote: > rather... super troll 100% Agreed. Can anyone say, "This looks like spam... Feels like spam... and is about as useful here in the Python forums as spam -- therfore my conclusion is that his VB message probably IS SPAM." :-D Brian --- -- http://mail.python.

Re: Excellent Site for Developers

2005-06-25 Thread Do Re Mi chel La Si Do
rather... super troll -- http://mail.python.org/mailman/listinfo/python-list

Re: a dictionary from a list

2005-06-25 Thread Michael Hoffman
Roy Smith wrote: > I just re-read the documentation on the dict() constructor. Why does it > support keyword arguments? > >dict(foo="bar", baz="blah") ==> {"foo":"bar", "baz"="blah"} > > This smacks of creeping featurism. Is this actually useful in real code? Personally, I use it all t

Re: super problem

2005-06-25 Thread Michael Hoffman
Uwe Mayer wrote: > I have a diamond-shaped multiple inheritanc chain with new style classes, > but super() does not call the parent class correctly: > > -- snip -- > from qtcanvas import * I don't have qtcanvas installed, and I couldn't reproduce the undesirable behavior using a dummy class. If

Re: a dictionary from a list

2005-06-25 Thread Jp Calderone
On Sat, 25 Jun 2005 09:10:33 -0400, Roy Smith <[EMAIL PROTECTED]> wrote: >Terry Hancock <[EMAIL PROTECTED]> wrote: >> Before the dict constructor, you needed to do this: >> >> d={} >> for key in alist: >> d[key]=None > >I just re-read the documentation on the dict() constructor. Why does it >s

Re: Office COM automatisation - calling python from VBA

2005-06-25 Thread Konstantin Veretennicov
On 6/25/05, Josef Meile <[EMAIL PROTECTED]> wrote: > You could try to do an addin/addon for Word, Excel, and Outlook. You > don't need to code with VBA. Here you just need a language from where > you can access the microsoft interop assemblies (ie: C++ or C#; > IronPython maybe?) Hmm... Why jump t

Re: Favorite non-python language trick?

2005-06-25 Thread Roy Smith
Steve <[EMAIL PROTECTED]> wrote: > One thing that I miss every once in a while is "pre-processing". There are so many things wrong with preprocessing, at least if you're thinking of the way C/C++ implements it (cpp). Cpp a number of things. 1) It does file inclusion. Pythons "import" serves th

Re: a dictionary from a list

2005-06-25 Thread George Sakkis
"Roy Smith" <[EMAIL PROTECTED]> wrote: > I just re-read the documentation on the dict() constructor. Why does it > support keyword arguments? > >dict(foo="bar", baz="blah") ==> {"foo":"bar", "baz"="blah"} > > This smacks of creeping featurism. Is this actually useful in real code? > It took

Re: execute python code and save the stdout as a string

2005-06-25 Thread Leif K-Brooks
jwaixs wrote: > I've a question. Can I execute a part of a python code and put it's > output in a string? >>> import sys >>> from cStringIO import StringIO >>> >>> def exec_and_get_output(code): ... old_stdout = sys.stdout ... sys.stdout = StringIO() ... try: ... exec c

Re: a dictionary from a list

2005-06-25 Thread Roy Smith
Terry Hancock <[EMAIL PROTECTED]> wrote: > Before the dict constructor, you needed to do this: > > d={} > for key in alist: > d[key]=None I just re-read the documentation on the dict() constructor. Why does it support keyword arguments? dict(foo="bar", baz="blah") ==> {"foo":"bar", "baz

Re: Life of Python

2005-06-25 Thread Benji York
Uwe Mayer wrote: > con: If you are planning larger applications (for a reasonable value of > "large") you have to discipline yourself to write well structured code. This is definitely true, no matter the language you use. > Then you will want to specify interfaces, If you're really interested i

Re: OT: Re: Looking For Geodetic Python Software

2005-06-25 Thread Diez B. Roggisch
> The article implied that the automated system would allow for > /shorter paths/ (the shortest path is the great circle, so this > statement indicates that trans-oceanic flights are not using great > circle/GPS routing). Most likely, the flights are using 50 minute "plumb > lines", with a he

execute python code and save the stdout as a string

2005-06-25 Thread jwaixs
Hello, I've a question. Can I execute a part of a python code and put it's output in a string? Something like this: s = "" s = exec """print "Hello World" """ print s Greetz, Noud -- http://mail.python.org/mailman/listinfo/python-list

super problem

2005-06-25 Thread Uwe Mayer
Hi, I have a diamond-shaped multiple inheritanc chain with new style classes, but super() does not call the parent class correctly: -- snip -- from qtcanvas import * class B2(QCanvasItem): def move(self, x,y): super(B2, self).move(0,0) print "B2" class C2(QCanvasItem): d

Re: Background thread

2005-06-25 Thread Jp Calderone
On Sat, 25 Jun 2005 11:36:57 +0100, Jorge Louis De Castro <[EMAIL PROTECTED]> wrote: >Hi, > >I'm new to python and I'm having trouble figuring out a way to have a thread >running on the background that over rules the raw_input function. The example >I'm working on is something like having a thre

Life of Python

2005-06-25 Thread Uwe Mayer
Hi, I have come across the following statement a number of times: http://mail.python.org/pipermail/python-list/2003-July/171805.html [... how to enforce pure abstract class ...] > Python, in general, doesn't try to stop the programmer doing things, the > way many other languages do. This is know

  1   2   >