Re: That's really high-level: bits of beautiful python

2006-02-22 Thread gene tani
Jeffrey Schwab wrote: > Max wrote: > > I was just thinking perhaps we should create some kind of collection of > > bits of "impressive" code like this. > > Do you mean something like the ASPN Cookbooks? > > http://aspn.activestate.com/ASPN/Cookbook/ > repositories, indexes and search engine

Re: That's really high-level: bits of beautiful python

2006-02-22 Thread Jeffrey Schwab
Max wrote: > I have a friend who has been programming in C for many years, and he is > a great fan of the language. However, he (and I) are about to start a > python course, and he has been asking me a lot of questions. He often > responds to my answers with "Urgh! Object-orientation!" and suchl

Re: That's really high-level: bits of beautiful python

2006-02-21 Thread Rocco Moretti
Max wrote: > But today we were discussing the problem of running externally-provided > code (e.g. add-on modules). Neither of us knew how to do it in C, though > I suggested using DLLs. However, I quickly installed python on his > laptop and coded this: > > exec "import %s as ext_mod" % raw_in

That's really high-level: bits of beautiful python

2006-02-21 Thread Max
I have a friend who has been programming in C for many years, and he is a great fan of the language. However, he (and I) are about to start a python course, and he has been asking me a lot of questions. He often responds to my answers with "Urgh! Object-orientation!" and suchlike. But today we

Re: Beautiful Python

2005-12-28 Thread John J. Lee
[EMAIL PROTECTED] writes: [...] > > Sometimes putting import statements at the beginning is not feasible > > (i.e. only when some condition has been met), as importing has some > > impact on program execution (importing executes code in imported > > module). This does not resemble Java imports (I d

Late binding and late execution (was: Beautiful Python)

2005-12-28 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On Tue, 27 Dec 2005 21:35:46 -0600, [EMAIL PROTECTED] declaimed the >following in comp.lang.python: > >> Wow ?! I've only started looking at python but that sounds like very >> dangerous programming ! Can you give an

Re: Beautiful Python

2005-12-27 Thread Steven D'Aprano
On Tue, 27 Dec 2005 21:35:46 -0600, news wrote: >> Sometimes putting import statements at the beginning is not feasible >> (i.e. only when some condition has been met), as importing has some >> impact on program execution (importing executes code in imported >> module). This does not resemble Java

Re: Beautiful Python

2005-12-27 Thread news
In article <[EMAIL PROTECTED]>, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Gekitsuu napisal(a): > > > use strict; > > use WWW::Mechanize; > > use CGI; > > > > This seems to be the de facto standard in the Perl community but in > > python it seems most of the code I look at has import statements >

Re: Beautiful Python

2005-12-27 Thread Peter Decker
On 27 Dec 2005 10:02:17 -0800, Gekitsuu <[EMAIL PROTECTED]> wrote: > My > hypothetical situation was as follows. I'm writing a new generic SQL > module and I want to make it so I only call the appropriate module for > the type of SQL server I'm talking to. Then it would make sense to > load, for in

Re: Beautiful Python

2005-12-27 Thread Fredrik Lundh
"Gekitsuu" wrote: > That is part of what I was asking but I was also hoping to hear the > common wisdom so to speak. When I posted I had considered the idea for > a bit and the situations people have mentioned were similar to the > scenario I came up with as a good time to break such a rule. My >

Re: Beautiful Python

2005-12-27 Thread Gekitsuu
That is part of what I was asking but I was also hoping to hear the common wisdom so to speak. When I posted I had considered the idea for a bit and the situations people have mentioned were similar to the scenario I came up with as a good time to break such a rule. My hypothetical situation was as

Re: Beautiful Python

2005-12-26 Thread rbt
[EMAIL PROTECTED] wrote: > Gekitsuu wrote: >> I've been reading a lot of python modules lately to see how they work >> and I've stumbled across something that's sort of annoying and wanted >> to find out of there was a good reason behind it. In a Perl program >> when you're calling other modules yo

Re: Beautiful Python

2005-12-26 Thread sconce
Gekitsuu wrote: > I've been reading a lot of python modules lately to see how they work > and I've stumbled across something that's sort of annoying and wanted > to find out of there was a good reason behind it. In a Perl program > when you're calling other modules you'll add "use" statements at th

Re: Beautiful Python

2005-12-26 Thread Chip Turner
On 2005-12-26 05:01:07 -0500, "Gekitsuu" <[EMAIL PROTECTED]> said: > I've been reading a lot of python modules lately to see how they work > and I've stumbled across something that's sort of annoying and wanted > to find out of there was a good reason behind it. In a Perl program > when you're cal

Re: Beautiful Python

2005-12-26 Thread Steven D'Aprano
On Mon, 26 Dec 2005 02:01:07 -0800, Gekitsuu wrote: > Is there a sound reason for putting the imports > there are are developers just loading modules in as they need them. I > own Damian Conway's book of Perl Best Practices and it seems from a > maintainability standpoint that having all the modu

Re: Beautiful Python

2005-12-26 Thread Jarek Zgoda
Gekitsuu napisal(a): > use strict; > use WWW::Mechanize; > use CGI; > > This seems to be the de facto standard in the Perl community but in > python it seems most of the code I look at has import statements > everywhere in the code. Is there a sound reason for putting the imports > there are are

Beautiful Python

2005-12-26 Thread Gekitsuu
I've been reading a lot of python modules lately to see how they work and I've stumbled across something that's sort of annoying and wanted to find out of there was a good reason behind it. In a Perl program when you're calling other modules you'll add "use" statements at the beginning of your scri