[no subject]

2005-06-20 Thread python-list-bounces+archive=mail-archive . com
#! rnews 4339
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Multiple instances of a python program
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 83
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Mon, 20 Jun 2005 14:14:24 GMT
Xref: news.xs4all.nl comp.lang.python:382535

"Rahul" <[EMAIL PROTECTED]> writes:

> Steven D'Aprano wrote:
> > On Thu, 16 Jun 2005 11:47:10 -0700, Rahul wrote:
> >
> > > Hi.
> > > I am part of a group in my univ where we organize a programming
> > > contest. In this contest we have a UDP based server. The server
> > > simulates a game and each contestant is to develop a team of virtual
> > > players. Each team is composed of 75 similar bots...i.e. governed by
> > > the same logic. Thus the contestant submits a single copy of the client
> > > and we instantiate the same program 75 times at the same time.
> > > The problem is that while executables from C source files are small and
> > > we can make 75 processes but we dont know what to do with python.
> > >
> > > If you have a python script and you want that 75 copies of the script
> > > be run simultaneously how will you do it? Is there anyway to do so
> > > without running 75 copies of the python interpreter simultaneously?
> >
> > Have you actually tested the performance of 75 instances of Python
> > running? Do you know that it will be too slow for your server, or are you
> > trying to optimize before testing?
> >
> > I wrote a short Python script, then launched 115 instances of Python
> > executing the script. There was no detectable slowdown of my system, which
> > is far from a high-end PC.
> >
> > The details of the script aren't important. It may even be that what I
> > tested is not even close to the load your server needs to deal with. But
> > you may be surprised at just how easily even a low-end PC copes 75
> > instances of Python. Or perhaps not -- but the only way to tell is to try.
> 
> Well...i havent tried (yes i hear "Premature optimization is evil evil
> evil i say") but the point was that if we can find a solution consuming
> less memory than we can even increase the number from 75 to lets say
> 200. as for hardware we have machines with 1.7 Ghz P4 and 128 mb ram.
> and i cant run them right now...since i am currently not in my
> univ...but asked now since we are planning right now and wanted to see
> which languages we can support. Probably c,c++,python and lisp using
> clisp...and java if we can find a way to avoid running 75 jvms...this
> year we supported c,c++,java and actually ran 75 jvms using 3 machines
> and it was horrible so we are looking for better ways for the 2006
> contest. And we may port our server from java to python too but it
> seems not many people had python installed but most had java installed.
> 
> rahul
> 

As others have said, start by testing.  Given 1.7 MHz and 128MB, I'm
guessing your performance problems are coming from swapping.  Simply
getting more RAM in the box would help.

A quick check on process load just for the instances themselves can be
done by gradually increasing max_processes (see below) until you swap.
On a box with 256MB total, 150MB free, I was getting over 150 children
before swap was noticeable.  By watching "top" I found each child was
using about 3MB, of which about 2MB is "shared" (basically, the python
library).  In other words, each instance was costing 1MB.

Of course, your actual apps will require more RAM than this little
test program.

---main program---
max_processes=10
progname="child.py"
for i in xrange(max_processes):
os.spawnv(os.P_NOWAIT,progname,[progname,str(i)])

---child program---
def msg(txt):
sys.stdout.write(txt)
sys.stdout.flush()

#get childnum from comline parameters

for i in xrange(10):
msg('%i ' % childnum)
time.sleep(1)

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-20 Thread python-list-bounces+archive=mail-archive . com
#! rnews 902
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Couple functions I need, assuming they exist?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 15
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Mon, 20 Jun 2005 20:12:51 GMT
Xref: news.xs4all.nl comp.lang.python:382593

Charles Krug <[EMAIL PROTECTED]> writes:

[snip]
> The target of the problems (my daughter) ...
[snip]

That sounds familiar :-).  See:
http://www.seanet.com/~hgg9140/math/index.html
http://www.seanet.com/~hgg9140/math/k6.html


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-28 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2994
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Boss wants me to program
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 57
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Tue, 28 Jun 2005 18:58:08 GMT
Xref: news.xs4all.nl comp.lang.python:383798

phil <[EMAIL PROTECTED]> writes:

> >
> > You are quite correct to point out how much better it is to know what is
> > going on behind the scenes.  But heck, once you know how to extract square
> > roots - you need to let the computer do it!
> > GUI interfaces should be the same deal!
> > Thomas Bartkus
> >
> I think I pretty much agree. I essentially code my own gui builder
> 
> but in text files.
> 
> I just think it is really important to emphasise the operative
> "but once you know how" in your comments.
> 
> Then some would counter with "oh, so we should code everthing
> in assembler?"  Ouch. No, I will admit there is judgement
> required.  Everything should be done the easiest way, with the
> qualification that you need to understand how using someone
> else's shortcut leaves you vulnerable.


I agree with your comments on Python and java and IDEs.  I'd like to
expand on the "code in assy" complaint.

Compiled-to-assy-to-machine-to-execution is understood and
algorithmic.  Any one person may no know it al,l but every step of the
way has been thought out and optimized by someone who knew what he/she
was doing.  There are very few places where anyone has to dive down
into assy, much less microcode or VLSI layouts.

Therefore, we can trust the abstract model provided by the programming
language, and can stay in that model.

This is not the case for GUIs.  We can't safely stay in the abstract
GUI IDE.  In fact, most require you to dive into the generated code to
finish the task.  Bouncing up and down the abstraction ladder is hard
and made harder by being forced to live in the IDE's idea of generated
code.

Given that, GUI IDEs are still helpful if your base langauge is a pain
to write and debug (e.g., C++, Java).  But if your language is
actually easier to use than the GUI IDEs, then the equation shifts.
With Python, the clarity of thought and the opportunities for
higher-level programming (dynamic code genration et al) make GUI IDEs
just a waste of time or worse.

I also have moved to text-based inputs to my own GUI builders.  Maybe
there is a sourceforge project waiting to be borne here :-)

[snip]

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-29 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1192
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!tiscali!transit0.news.tiscali.nl!tudelft.nl!txtfeed1.tudelft.nl!feeder2.cambrium.nl!feed.tweaknews.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!in.100proofnews.com!in.100proofnews.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Boss wants me to program
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 18
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Wed, 29 Jun 2005 19:43:22 GMT
Xref: news.xs4all.nl comp.lang.python:384026

"Adriaan Renting" <[EMAIL PROTECTED]> writes:
[snip]
> This doesn't mean I would recommend VB for everything. For large
> projects C++ or java can both be far superior, depending on needs and
> available tools and libraries. I realy like Python for small projects on
> Linux. Both VB and Python are easier to learn as the more powerful
> languages, the price is that they lack features that make it easier to
> manage large and complex projects.
> 
[snip]

What is a large project, and what is Python missing that C++ and Java
have for such tasks?   

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-30 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2572
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Modules for inclusion in standard library?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 39
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]>
Mime-Version: 1.0
Date: Thu, 30 Jun 2005 13:38:28 GMT
Xref: news.xs4all.nl comp.lang.python:384160

Paul Rubin  writes:

> Rocco Moretti <[EMAIL PROTECTED]> writes:
> > Except that (please correct me if I'm wrong) there is somewhat of a
> > policy for not including interface code for third party programs which
> > are not part of the operating system. (I.e. the modules in the
> > standard libary should all be usable for anyone with a default OS +
> > Python install.)
> 
> I've never heard of Python having such a policy and I don't understand
> how such a stupid policy could be considered compatible with a
> proclaimed "batteries included" philosophy.  Why would Python
> advocates want to make Python deliberately uncompetitive with PHP,
> Java, and other languages that do include database modules?
> 
> > A notable exception is the dbm modules, but I seem to recall hearing
> > that the official position is that it was a mistake. (Now only kept
> > for backward compatability.)
> 
> Ahem: Tkinter.  There's actually several more, looking in the lib docs.

I typically install dozens of python packages (on IRIX, Solaris, AIX,
Linux, Win2K).  21 are standalone enough to be considered for the std
library.  However I wouldn't necessarily want them in there, because:

a) They have their own release cycles, and coordinating would be too
painful.  We'd get a Python-1.2.3 with a package ABC-2.3.4 which is
(too late) discovered to have a bug.  So everyone would have to
download ABC-2.3.5 and install it anyway.

b) Installing distutils-aware python packages is trivial.  I'd rather
the energy which might go into a bigger std library go instead into
helping projects which don't have distutils-style builds.


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-30 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2218
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Boss wants me to program
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 39
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Thu, 30 Jun 2005 13:53:07 GMT
Xref: news.xs4all.nl comp.lang.python:384162

Peter Hansen <[EMAIL PROTECTED]> writes:

> Harry George wrote:
> > "Adriaan Renting" <[EMAIL PROTECTED]> writes:
> >>Both VB and Python are easier to learn as the more powerful
> >>languages, the price is that they lack features that make it easier to
> >>manage large and complex projects.
> > What is a large project, and what is Python missing that C++ and Java
> > have for such tasks?
> 
> But C++ and Java have features that *management* likes, thus making it
> "easier to manage large projects".  (That says nothing about whether
> or not it makes it easier to produce quality code, successful
> projects, happy customers, large profits, or any such silly
> things... just that it's "easier to manage". ;-)
> 
> Less facetiously: I have managed a large Python project or three, and
> several large C++ projects (and, thankfully, no large Java projects)
> and found Python quite up to the task.  In fact, if anything the C++
> projects ended up more in danger of succumbing to the sheer weight of
> the code than did the Python projects.  But I attribute this more to
> the fact that we had evolved to using agile approaches with the Python
> projects than to any of those special features either present or
> lacking in C++.
> 
> Ultimately, manageability of a project is far and away more about the
> people involved and the techniques used than it is about any single
> technology involved.
> 
> -Peter

That's our experience too (and the reason I asked).  I wonder if the
OP will respond.


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-07-01 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1856
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!tiscali!transit0.news.tiscali.nl!tudelft.nl!txtfeed1.tudelft.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newspeer1.nwr.nac.net!in.100proofnews.com!in.100proofnews.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Modules for inclusion in standard library?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 26
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 1 Jul 2005 13:46:28 GMT
Xref: news.xs4all.nl comp.lang.python:384359

Mike Meyer <[EMAIL PROTECTED]> writes:

> Harry George <[EMAIL PROTECTED]> writes:
> 
> > b) Installing distutils-aware python packages is trivial.  I'd rather
> > the energy which might go into a bigger std library go instead into
> > helping projects which don't have distutils-style builds.
> 
> How about integrating distutils and PyPI, so that distutils can
> automatically download and install packages that are required by the
> package it's currently installing? In other words, C-Python-AN.
> 
>  -- 
> Mike Meyer <[EMAIL PROTECTED]>
> http://www.mired.org/home/mwm/
> Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

I personally don't do auto download/installs, preferring instead to
scan the code before build/install.  However, getting a list of
dependencies would be nice.   Maybe a setup.py --requires flag.


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-07-01 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1689
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Python for everything?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 29
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 1 Jul 2005 14:10:56 GMT
Xref: news.xs4all.nl comp.lang.python:384366

Tom Anderson <[EMAIL PROTECTED]> writes:

> On Thu, 30 Jun 2005 [EMAIL PROTECTED] wrote:
> 
> > can Python "do it all"?
> 
[snip]
> The other is in bit-twiddling - anything that involves
> mucking about with data at the level of bits and bytes. Maybe this is
> just blind prejudice, but i'm never as comfortable hacking on that
> sort of stuff (writing a Huffman coder, say) in python as in java.

Maybe we should distinguish:

1. Can you do it at all?  Yes, via the struct package and via the bit
   operators.  And, the bit operators support the same idioms we all
   know and love from C.

2. Can it be done "fast enough"?  Maybe.  I wrote a Morse code
   generator based on algorithms from a C program, which generated pcm
   files.  The initial cut was way too slow.  Then I did some caching
   and got it fast enough to use.  Still not C speeds, but fast enough
   for the task.  But if you are doing encryptions (where even C is
   giving way to hardware), then Python is not the answer.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-07-01 Thread python-list-bounces+archive=mail-archive . com
#! rnews 4560
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: 
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 115
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 1 Jul 2005 16:40:26 GMT
Xref: news.xs4all.nl comp.lang.python:384402

Tom Anderson <[EMAIL PROTECTED]> writes:

> On Fri, 1 Jul 2005, Adriaan Renting wrote:
> 
> > I'm not a very experienced Python programmer yet, so I might be
> > mistaken, but there are a few things that would make me prefer C++
> > over Python for large (over 500.000 LOC) projects.

Strictly in terms of software engineering and language design, Python
may well be better suited to large projects than C++ or Java.  Code
re-use, original coding and prototyping, unittests, and peer reviews
are a lot easier with Python than with C++ or Java.

The problem is that large projects tend to have portions which are
performance sensitive.  So a project might be 100K LOC of C with 200K
LOC of Python.

> 
> Hmm. I don't know C++, but here goes ...
> 
> > - namespaces
> 
> Aren't namespaces basically the same as packages/modules in python?
> 

They serve the same purpose but are not 1:1 with a file.  I personally
can't think of a situation where I'd want 2 or more namespaces in a
physical file, or 2 or more files per namespace.  Therefore I don't
see any advantage in the C++ approach.

> > - templates
> 
> These would be meaningless in python - they're part of typefulness, which ...
> 
> > - strong type checking
> 
> ... python eschews.

Templates address (I hesitate to say "solve") static typing by adding
back the polymorphism that static typing eliminates.

Python avoids the fix-on-a-fix by doing dynamic strong typing in the
first place.

> 
> Not that this is necessarily a good thing. I have to say that my Java
> roots do lead me to think that strong typing is a plus for big
> projects, since it's a way of defining and enforcing interfaces
> between bits of code written by different people (or by one person at
> different times!). Optional static typing in python would be nice for
> this.
> 

Java has nothing on Modula-3.  Talk about strong static typing... It
used to take me 3 days to get the first compile to run on a new
project.

Yet after years of Modula-3 (and repeatedly seeing strong static typing
pay off) I found python quite comfortable.  Somehow the problems
strong static typing addresses aren't a problem.

> > - data hiding
> 
> Surely you can hide data in python?
> 

You can't genuinely hide data in Python.  The best you can do is the
"_" idiom.  

The question is why was data hiding invented in the first place.  It
prevents attempts to get at the underlying mechanisms instead of
sticking with the external API.  There are two reasons for this:

a) Protection of the algorithms (e.g., trade secrets).  Python doesn't
solve that.  Neither do C++ or Java, or assembler.  If you have access
to the binary, you can reverse engineer the functionality.

b) Prevent ill-considered attempts at optimization through use of the
lower layers.  Those layers are there for a reason, usually to protect
the external API from changes in the underlying library.  Python
solves that by attracting programmers intelligent enough to understand
this.:-)

> > - more available libraries and more advanced developement tools.

If the library is in C, C++, or FORTRAN, Python can use it.  Worst
case you have to write your own bindings.

As for "advanced development tools"... That's a flameware waiting to happen.

> 
> True. The more advanced development tools are offset to a large degree
> by the advanced crappiness of C++ as a language, though; i'd be
> surprised if a C++ programmer borged up with all the latest tools was
> actually more productive than a python programmer with a
> syntax-colouring, auto-indenting text editor. It'd be very interesting
> to get some real numbers on that.
> 
> >> Ultimately, manageability of a project is far and away more about the
> >> people involved and the techniques used than it is about any single
> >> technology involved.
> >
> > Agreed.
> 
> +1 getting to the crux of it.
> 
> tom
> 
> -- 
> In-jokes for out-casts

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-01 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1106
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wns13feed!worldnet.att.net!12.120.4.37!attcg2!ip.att.net!xyzzy!nntp
From: Jeff Sandys <[EMAIL PROTECTED]>
Subject: Re: Delete first line from file
X-Nntp-Posting-Host: e515855.nw.nos.boeing.com
Content-Type: text/plain; charset=iso-8859-1
Message-ID: <[EMAIL PROTECTED]>
Sender: [EMAIL PROTECTED] (Boeing NNTP News Access)
Content-Transfer-Encoding: 8bit
Organization: juno
X-Accept-Language: en
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Tue, 1 Mar 2005 16:41:02 GMT
X-Mailer: Mozilla 4.79 [en]C-CCK-MCD Boeing Kit  (Windows NT 5.0; U)
Xref: news.xs4all.nl comp.lang.python:365187
Lines: 23

You describe the standard behavior, unless you close the file, 
is that what you want to do; open file, read line 1, close file,
then open file, read line 2, close file?  The other suggestions 
here destory content, do you want that?

>>> f = open("D:/Pydev/test.txt")
>>> f.readline()
'line one\n'
>>> f.readline()
'line two\n'
>>> f.readline()
'line three\n'


"Tor Erik Sønvisen" wrote:
> 
> Hi
> 
> How can I read the first line of a file and then delete this line, so that
> line 2 is line 1 on next read?
> 
> regards
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-04 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2494
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wns13feed!worldnet.att.net!12.120.4.37!attcg2!ip.att.net!xyzzy!nntp
From: Jeff Sandys <[EMAIL PROTECTED]>
Subject: Re: Delete first line from file
X-Nntp-Posting-Host: e515855.nw.nos.boeing.com
Content-Type: text/plain; charset=iso-8859-1
Message-ID: <[EMAIL PROTECTED]>
Sender: [EMAIL PROTECTED] (Boeing NNTP News Access)
Content-Transfer-Encoding: 8bit
Organization: juno
X-Accept-Language: en
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 4 Mar 2005 16:15:55 GMT
X-Mailer: Mozilla 4.79 [en]C-CCK-MCD Boeing Kit  (Windows NT 5.0; U)
Xref: news.xs4all.nl comp.lang.python:365744
Lines: 71

Here is a non-destructive way keeping track of the 
current file position when closing the file and 
re-open the file where you left off.  You can 
always use seek(0) to go back to the beginning.

# -- start of myfile class
class myfile(file):
myfiles = {}
def __init__(self, fname, *args):
file.__init__(self, fname, *args)
if self.name in myfile.myfiles:
pos = myfile.myfiles[fname]
else:
pos = 0
return self.seek(pos)
def close(self):
myfile.myfiles[self.name] = self.tell()
file.close(self)
#  end of myfile class

Below is an example with a simple four line file.

PythonWin 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)]
on win32.
Portions Copyright 1994-2001 Mark Hammond ([EMAIL PROTECTED]) -
see 'Help/About PythonWin' for further copyright information.
>>> f = open("C:/Pydev/test.txt")
>>> f.readlines()
['line one\n', 'line two\n', 'line three\n', 'last line\n']
>>> ### short four line file
>>> f.close()
>>> from myfile import myfile
>>> f = myfile("C:/Pydev/test.txt")
>>> f.readline()
'line one\n'
>>> f.readline()
'line two\n'
>>> f.close()
>>> ### test, is the file really closed?
>>> f.readline()
Traceback (most recent call last):
  File "", line 1, in ?
ValueError: I/O operation on closed file
>>> f = myfile("C:/Pydev/test.txt")
>>> f.readline()
'line three\n'
>>> ### reopened file starts where it left off
>>> f.readline()
'last line\n'
>>> f.close()
>>> f = myfile("C:/Pydev/test.txt")
>>> f.seek(0)
>>> ### return to the beginning of the file
>>> f.readline()
'line one\n'
>>> 

This turned out really cool,
thanks for the good question,
Jeff Sandys


"Tor Erik Sønvisen" wrote:
> 
> Hi
> 
> How can I read the first line of a file and then delete this line, so that
> line 2 is line 1 on next read?
> 
> regards
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-24 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2393
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Getting the word to conventional programmers
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 43
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]>
Mime-Version: 1.0
Date: Thu, 24 Mar 2005 15:58:17 GMT
Xref: news.xs4all.nl comp.lang.python:368964

"Roose" <[EMAIL PROTECTED]> writes:

> > Except from a the standard, powerful,
> > looks-good-everywhere-and-has-a-tree-widget GUI toolkit? :)
> >
> > Seriously, I think this is *very* important.
> 
> Yes, and a modern toolset/IDE.  Generators and decorators and all that are
> nice, but their usefulness pales in comparison to having a decent IDE or GUI
> toolkit.
> 
> Though I might disagree that Java has a good GUI toolkit, it has better
> tools than any language out there IMO.  And I don't really like Java
> personally.
> 
> 

"Modern toolset/IDE"?  Them's fightin' words. 

Since Babbage figured out stored programs and the transistor made them
viable, we have learned a crucial lesson: Whatever you want to think
about, make sure it can be programmed.  Do NOT require
human-in-the-loop.

>From this perspective a mouse-driven GUI for generating code or GUI
designs is a horse-and-buggy concept.  Instead, a programmer uses
dynamic programming and (as needed) static code generation.  He/she
captures rules needed to generate appropriate GUIs and only
hand-tweaks the results when the rules cannot be fully understood
(artistic stylings).

Now, what is the best way to capture rules and algorithms?  It is a
powerful-yet-succinct language in an editor which supports a fast
think-edit-run cycle.  IDEs do a lot of things but generally don't win
this contest; text editors do.  Give me python in emacs any day.  Let
my Extreme Programming partner use whatever editor he/she likes, and
we'll refresh our editor buffers when we change chairs.  IDEs just gum
up the works.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-25 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1995
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Jeff Sandys <[EMAIL PROTECTED]>
Subject: Re: Python for a 10-14 years old?
X-Nntp-Posting-Host: e515855.nw.nos.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
Sender: [EMAIL PROTECTED] (Boeing NNTP News Access)
Content-Transfer-Encoding: 7bit
Organization: juno
X-Accept-Language: en
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 25 Mar 2005 16:09:50 GMT
X-Mailer: Mozilla 4.79 [en]C-CCK-MCD Boeing Kit  (Windows NT 5.0; U)
Xref: news.xs4all.nl comp.lang.python:369133
Lines: 35

How to Think Like a Computer Scientist is a great book for this 
age group.  It is easy to read, in nice easy to digest steps, with 
enough examples.  I will be using this book for a Middle School 
(7-8 grade, 12-14 year old) Python Programming Club.  The hard 
part is guiding students into rewarding projects that can be 
accomplished in a short time.

John Zelle's _Python Programming: An Introduction to Computer 
Science_ is also a very good, but it is aimed at high school and 
first year college students.

Another thing that might be useful is if she has a friend that is 
interested in learning programming.  They can pair program with one 
reading the book while the other drives the computer.  Learning is 
faster and more fun with pair programming.

Check out the Python Edu-SIG:
http://www.python.org/sigs/edu-sig/

[EMAIL PROTECTED] wrote:
> 
> ... The only tutorial I have found so far is
> "How to Think Like a Computer Scientist - Learning with Python" which,
> while very good indeed, is geared towards adult newbie students.
> 
> Is there something out there like "Python for kids" which would explain
> *basic* programming concepts in a way which is accessible and
> entertaining for kids aged 10-14 (that about where her brain is right
> now) and which would allow them to "play around" and have fun solving
> small problems?
> 
> Many thanks in advance,
> 
> TN
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-28 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2354
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!in.100proofnews.com!in.100proofnews.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Which is easier? Translating from C++ or from Java...
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 47
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Mon, 28 Mar 2005 21:24:53 GMT
Xref: news.xs4all.nl comp.lang.python:369571

"cjl" <[EMAIL PROTECTED]> writes:

> Hey all:
> 
> I'm working on a 'pure' python port of some existing software.
> 
> Implementations of what I'm trying to accomplish are available (open
> source) in C++ and in Java.
> 
> Which would be easier for me to use as a reference?
> 
> I'm not looking for automated tools, just trying to gather opinions on
> which language is easier to understand / rewrite as python.
> 
> -cjl
> 

I've done a bit of manual porting from C++ and from Java, but never
for the same algorithm.  Here are some points to consider:

1. Java is already garbage collected, object oriented, and generally
   "safe".  So an algorithm could be copied almost verbatim into
   Python.  In C++ you might get pointers, casts, etc. which would
   leave you stumped.

2. Java as a community is trying to reinvent the wheel for everything
   you might already have in a library.  So whereas in C++ you might
   just bind to the same library, in Java you might have to fight your
   way through layer after layer of java-isms.  You could end up doing
   more work replicating the java-esque libraries than in doing the
   actual code of interest.

Thus there is a tradeoff.  For pure algorithms and
computer-science-ish programs, java may be easier.  For anything that
uses libraries and API's, C++ may be easier.

As a practical matter, I have found I need to read the code and
understand it in the original language.  Then, inspired by this
insight, I write a wholly new python program, using python-esque
idioms.  So it comes down to which particular piece of code is easier
to understand, and that in turn depends more on the original author's
style than on the language.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-30 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1551
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: why and when we should do it?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 43
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Wed, 30 Mar 2005 14:16:34 GMT
Xref: news.xs4all.nl comp.lang.python:369917

Su Wei <[EMAIL PROTECTED]> writes:

> hi,everybody,Sorry to bother you. 
> i hvae seen some code like this before:
> 
> class BusinessBO :
> dev __init__(slef):
> #write you own code here
> dev businessMethod :
> #write you own code here
> pass
> 
> why and when we should add the keyword "pass" ?
> 
> and some time i have seen
> 
> class SomeObject(Object) :
>   #some code
> 
> why and when we should inherit Object?
> 
> thanks in advanced.
>

There are enough typos in your example that I'm guessing you actually saw:

  class BusinessBO :
  def __init__(self):
  #write you own code here
  pass
  def businessMethod(self):
  #write you own code here
  pass


"pass" is the Python way to say "Yes, I know there should be code
here, but I don't want any."  It is required in this context because a
"def" cannot be totally empty.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-31 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1066
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: hex string into binary format?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 28
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Thu, 31 Mar 2005 14:58:03 GMT
Xref: news.xs4all.nl comp.lang.python:370100

"Tertius Cronje" <[EMAIL PROTECTED]> writes:

> Hi, 
> 
> How do I get a hexvalued string to a format recognized for binary
> calculation?
> 
> 
> import binascii
> s1 = '1C46BE3D9F6AA820'
> s2 = '8667B5236D89CD46'
> 
> i1 = binascii.unhexlify(s1)
> i2 = binascii.unhexlify(s2)
> x = i1 ^i2
> 
>   TypeError: unsupported operand type(s) for ^: 'str' and 'str'
> 
> Many TIA
> T

i1=int(s1,16)
i2=int(s2,16)

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-03-31 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1765
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!tiscali!transit0.news.tiscali.nl!tudelft.nl!130.161.131.117.MISMATCH!tudelft.nl!newsfeed.multikabel.nl!gatel-ffm!gatel-ffm!proxad.net!proxad.net!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Generating RTF with Python
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 37
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Thu, 31 Mar 2005 20:56:42 GMT
Xref: news.xs4all.nl comp.lang.python:370154

Axel Straschil <[EMAIL PROTECTED]> writes:

> Hello!
> 
> > does anyone know of a high-level solution to produce RTF from Python=20
> > (something similar to
> > Reportlab for producing PDF)?
> 
> Spend hours of googeling and searching, also in this NG, about two
> months ago. My conclusion is: On windwos, maybe you can include some
> hacks with dll's, under linux, linux support for generating rtf is none,
> and so is python's.
> 
> My workaround was: 
> http://www.research.att.com/sw/download/
> This includes an html2rtf converter, which I access from python via
> popen and temporary files. Not high-level, not very sexy ... ;-(
> 
> Lg,
> AXEL.
> -- 
> "Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
> http://www.informatik-forum.at/showpost.php?p=206342&postcount=10

I generate docbook and convert that to rtf.  I generate the docbook
from my pdx markup:

http://www.seanet.com/~hgg9140/comp/index.html#L007

If you go this route, your python code is actually writing pdx, and
you need a 2 step conversion (pdx2docbook.py, then openjade for the
xml-to-rtf step).

-- 
[EMAIL PROTECTED] 
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-04-04 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2776
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!central.cox.net!east.cox.net!filt02.cox.net!peer01.cox.net!cox.net!attga1!attga2!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: unittest vs py.test?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 49
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Mon, 4 Apr 2005 15:30:36 GMT
Xref: news.xs4all.nl comp.lang.python:370744

[EMAIL PROTECTED] (Roy Smith) writes:

> Peter Hansen  <[EMAIL PROTECTED]> wrote:
> >It seems possible to me that I might have helped him
> >solely by pointing out that unittest might not be so
> >"heavy" as some people claimed.  I got the impression
> >that he might be swayed by some unfounded claims not
> >even to look further at unittest, which I felt would
> >be a bad thing.
> 
> I'm the "him" referred to above.  I've been using unittest ever since
> it was first added to the standard library (actually, now that I think
> about it, I believe I may have been using it even before then).
> 
> And yes, I think unittest brings along a certain amount of baggage.
> There is something attractive about having the same basic framework
> work in many languages (PyUnit, JUnit, C++Unit, etc), but on the other
> hand, it does add ballast.  I use it, I certainly don't hate it, but
> on the other hand, there are enough things annoying about it that it's
> worth investing the effort to explore alternatives.
> 
> From the few days I've been playing with py.test, I think I like what
> I see, but it's got other issues.  The "optimization elides assert"
> issue we've been talking about is one.
> 
> It's also neat that I can write unittest-style test classes or go the
> simplier route of just writing static test functions, but there's a
> certain amount of TIMTOWTDI (did I spell that right?) smell to that.
> 
> I'm also finding the very terse default output from unittest (basicly
> a bunch of dots followed by "all N tests passed") highly preferable to
> py.test's verbosity.
> 
> In short, I haven't made up my mind yet, but I do appreciate the input
> I've gotten.
> 
> 

I haven't used pytest, so no comparisons to offer.  But for unittest,
I've found a lot of the "baggage" can be automated.  My mkpythonproj
(http://www.seanet.com/~hgg9140/comp/index.html#L006) does that.  When
you generate a project, you get a unittest suite with a default test
ready to run, and the mechanisms needed to add more.


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-04-05 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1227
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: IronPython 0.7 released!
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 19
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Tue, 5 Apr 2005 19:05:05 GMT
Xref: news.xs4all.nl comp.lang.python:370993

Thomas Gagne <[EMAIL PROTECTED]> writes:

> Does the Python community think Microsoft's embrace is a good or bad thing?
> 
> James wrote:
> > http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742
> >

"Please refer to uploaded documentation for full text of the Shared
Source License for IronPython" says it all.

Shared Source is an abomination, complete with the risk of
cross-contaminating true OSS projects.  I wouldn't voluntarily use the
thing and I certainly wouldn't look at the source code.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-04-06 Thread python-list-bounces+archive=mail-archive . com
#! rnews 4875
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Best editor?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 106
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Wed, 6 Apr 2005 14:22:57 GMT
Xref: news.xs4all.nl comp.lang.python:371122

"ChinStrap" <[EMAIL PROTECTED]> writes:

> When not using the interactive prompt, what are you using? I keep
> hearing everyone say Emacs, but I can't understand it at all. I keep
> trying to learn and understand why so many seem to like it because I
> can't understand customization even without going through a hundred
> menus that might contain the thing I am looking for (or I could go
> learn another language just to customize!).
> 
> Personally I like SciTE, it has everything I think a midweight editor
> should: code folding, proper python support, nice colors out of the
> box, hotkey access to compile (I'm sure emacs does this, but I couldn't
> figure out for the life of me how), etc.
> 
> Opinions on what the best is? Or reading I could get to maybe sway me
> to Emacs (which has the major advantage of being on everyone's system).
> 

The key (as others have said) is to know your editor and be effective
with it.  As long as it can handle ASCII, does autoindent, and knows
tab-is-4-chars, then it is a viable choice.

Since you asked specifically about emacs, and whether or not it is
worthwhile...

I've used emacs for 15 years, and am still learning useful new tricks
at a rate of about one per 6 months.  But I've also found that the
essentials can be taught in a 2 hour session and mastered in about 2
weeks of use.  I've taught dozens of people using this "Essential
Emacs" approach.  

We find that emacs is for people who will be doing serious editing all
day long (e.g., programmers).  I like that comment from another
poster: "Emacs is a good place to live, but I wouldn't want to visit
there."

For people who will just be editing an occassional file (and no python
code), we recommend notepad or nedit.

Now then, how do we use emacs?

1. Proper setup is essential.  Assuming you have python-mode.el and
.elc in emacs's program-modes dir, then your .emacs needs:

;---python---
(load "python-mode")
(setq auto-mode-alist
  (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
  (cons '("python" . python-mode)
interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(add-hook 'python-mode-hook 'turn-on-font-lock)
(setq python-mode-hook 'python-initialise)
(defun python-initialise ()
  (interactive)
  (setq default-tab-width 4)
  (setq indent-tabs-mode nil)
)


2. I almost never use the interactive prompt.  There are people here
who do, but as soon as the script is more than a couple lines long, it
takes longer to reenter the code (even copy-and-paste) than to
edit-save-run a dummy batch script.  When I'm doing Extreme
Programming with such people, I insist on using a stopwatch and
checking which approach is more efficient -- they usually come over to
my approach.

3. I run emacs with split windows:
a) Edit the working code
b) Edit the unittest code
c) Run a shell script, where I (re)run the "go_test" script by doing
alt-p ret

In another frame (same emacs process, different frame) I keep the
oracle (known good) and test outputs in split windows, and maybe do
ediff-buffers on them if the deltas are not obvious.   

For each module under consideration (view or edit), I use a separate
emacs process in a similar manner.  In normal work, that means 1-4
emacs processes running, each with its own shell and own test cycles.

4. Elsewhere I'm running emacs rmail all day, and run emacs gnus several
times a day (like now).

5. When I do Extreme Programming, the other author(s) tend to be using
emacs, vim, or nedit.  We don't let people use notepad for python
becuause it doesn't know proper formatting.  IDE's tend to want to own
the whole show, which makes cross-tool Extreme Programming a pain.

As long as the other programmers have set their editors for
auto-indention and tab-is-4-chars, then we get along fine.  [I do
notice a sizeable delay when vim people search for the appropriate
shell windows, instead of having them in a (joined-at-the-hip) split
window.  This has more to do with bookkeeping than with editors per
se, but it is a data point.]

6. On IDE's and code-completion: If you are going to be typing the
same thing over and over, why not use a function, or maybe code
generation?

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/

(no subject)

2005-04-06 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2135
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Best editor?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 49
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]>
Mime-Version: 1.0
Date: Wed, 6 Apr 2005 19:35:28 GMT
Xref: news.xs4all.nl comp.lang.python:371180

"ChinStrap" <[EMAIL PROTECTED]> writes:

> Well I would be more than willing to learn Emacs if it does all these
> things you speak of, but really I can't get started because the default
> scheme is so friggin ugly it isn't funny.
> 
> Anyone want to send me a configuration setup with Python in mind, and
> decent colors?
> 

Set .emacs for:
;;; basic
(set-background-color "white")
(set-foreground-color "black")
(set-border-color "black")
(setq column-number-mode t)
(setq dired-ls-F-marks-symlinks t)

Do that prior to the python settings:
;---python---
(load "python-mode")
(setq auto-mode-alist
  (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
  (cons '("python" . python-mode)
interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(add-hook 'python-mode-hook 'turn-on-font-lock)
(setq python-mode-hook 'python-initialise)
(defun python-initialise ()
  (interactive)
  (setq default-tab-width 4)
  (setq indent-tabs-mode nil)
)


Then the default color scheme looks ok (at least to me).
The critical command is:
(add-hook 'python-mode-hook 'turn-on-font-lock)

If you comment that out (with a leading ";"), then font coloring is
turned off and you just have black on white.  You can learn the
language and the editor in that mode if necessary.


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
#! rnews 1727
Xref: xyzzy comp.security.ssh:39215
Newsgroups: comp.security.ssh
Path: xyzzy!nntp
From: "Mike Lowery" <[EMAIL PROTECTED]>
Subject: Re: Ignoring known_hosts
X-Nntp-Posting-Host: e458612.nw.nos.boeing.com
Message-ID: <[EMAIL PROTECTED]>
X-Mimeole: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Priority: 3
X-Msmail-Priority: Normal
Lines: 33
Sender: [EMAIL PROTECTED] (Boeing NNTP News Access)
Organization: The Boeing Company
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]>
Date: Wed, 6 Apr 2005 19:36:09 GMT


"Richard E. Silverman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > "Mike" == Mike Lowery <[EMAIL PROTECTED]> writes:
>
> >> [~/.ssh/known_hosts]
> >>
> >> foo [foo's key ...]  bar [foo's key ...]
> >>
> >> [~/.ssh/config]
> >>
> >> host foo hostname  hostkeyalias foo
> >>
> >> host bar hostname  hostkeyalias bar
> >>
> >> ... and use "ssh {foo|bar}".
>
> Mike> This might work
>
> It will work.
>
> Mike> but again, it requires me manually adding each server to the
> Mike> config file which I'm hoping to avoid since there are many.
>
> How?  If your machines are not uniquely identified to the client by their
> names or addresses, then you must indicate the distinctions yourself by
> configuration.

How?  Tell SSH to stop checking for this potential "problem." I don't care that
the key doesn't match what it was last time, just give me access!  Apparently
that option doesn't exist.


-- 
http://mail.python.org/mailman/listinfo/python-list


(no subject)

2005-04-15 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2153
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!transit0.news.tiscali.nl!tiscali!newsfeed1.ip.tiscali.net!proxad.net!proxad.net!newshosting.com!nx02.iad01.newshosting.com!novia!feed2.newsreader.com!newsreader.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Python's use in RAD
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 46
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 15 Apr 2005 15:33:58 GMT
Xref: news.xs4all.nl comp.lang.python:372620

"Ross Cowie" <[EMAIL PROTECTED]> writes:

> Hi,
> 
> I am currenly a second year university student and was wondering if
> you could help me ut. As part of a project i have decided to write
> about python, i am not having very much luck with regards to finding
> infrmation on pythons use in Rapid Application Development, and was
> wondering of you could highlight some of the features that make it
> suitable for RAD. Like the use of dinamic binding.
> 
> Your healp would be appreciated.
> 
> Hope to hear from you soon.
> 
> Ross
> 
> 

Generally we don't do homework here.   But we can give you pointers.

1. Searching google for "python RAD" shows 148,000 hits, and at least
   the first few pages look relevant.  Did you check?

2. "RAD" means different things to different people.   Do you mean:
a) Agile/Extreme Programming (2 or more people working together)
b) Test-driven
c) GUI builder
d) Rapid edit-run cycle
e) Lots of libraries so your work is just hooking together existing tools
f) Dynamic, code-generated-on-the-fly, or other meta programming
g) Project management experience in life cycle flow times and labor costs

You need to understand your assignment in these terms, then you can
investigate Python.

3. As a practical matter, Python does "a"-"g" quite well.  Originally
this was because of the rich-yet-clean syntax and batteries-included
libraries.  These days those factors still count, but they are
enhanced by large numbers of "other" libraries and tools which have
Python bindings.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-05-03 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1990
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Py2Exe security
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 35
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Tue, 3 May 2005 13:18:19 GMT
Xref: news.xs4all.nl comp.lang.python:375624

"Terje Johan Abrahamsen" <[EMAIL PROTECTED]> writes:

> Hello.
> 
> We have created some programs in Python that are to be distributed
> around. The programs will be made into .exe files by py2exe. However,
> in the source there are certain webadresses, logins and passwords that
> the programs use, that we would like to keep away from the end users.
> They will use them thru the program, but we would like them not to be
> extracted and used separately for other purposes.
> 
> Is the compiling by py2exe enough? I have opened all the files in the
> directory py2exe has made, and have not found anything I could read in
> clear text. However, that does not mean that others can not. Is it
> possible to extract these passwords, adresses and logins from the
> sourcecode? If py2exe is not enough, is there some other simple tools
> we can use to hide the source from the endusers?
> 
> Thanks in advance.
> 

Putting passwords in your program is a bad idea, with or without
Python and py2exe.  Even if you wrote the program in obfuscated C, and
stripped comments etc, an attacker could use "strings" to search for
candidate passwords.  Or just start at the beginning of the program
and use each byte as a candidate starting char.


Since you are working on MS Windows, consider getting:
M. Howard, D. LeBlanc, "Writing Secure Code", Microsoft Press, 2002.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-05-13 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2528
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: String formatting strangeness
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 55
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 13 May 2005 14:03:03 GMT
Xref: news.xs4all.nl comp.lang.python:377190

[EMAIL PROTECTED] writes:

> I must be doing something wrong, but for the life of me, I can't figure
> out what.  Here's the code snippet which is giving me grief:
> 
> print type(number), type(name), type(seconds // 60), type(seconds % 60)
> print "\t\t\t\n"
> % [number, name, seconds // 60, seconds % 60]
> 
> (These are lines 49 and 50 of the script; I can post the whole thing if
> someone wants, but I think this is enough to see why it's driving me
> nuts.)
> 
> And the output:
> 
>
> Traceback (most recent call last):
>   File "X:\Music (FLAC)\Post-process new rips.py", line 50, in ?
> print "\t\t\t length=\"%i:%i\"/>\n" % [number, name, seconds // 60, seconds % 60]
> TypeError: int argument required
> 
> Wait, what?  The first line clearly identifies that the the first,
> third, and fourth elements are all integers, yet the error says that
> *lack* of integers is the problem.  If I change all "%i"s to "%d", I
> get the same problem, and changing to "%s" (hey, it was worth a shot)
> gives "TypeError: not enough arguments for format string" instead.
> Huh?  I see four placeholders and a four-element tuple.
> 
> Can anyone enlighten me here?
> 

I notice you used a list instead of a tuple.   
Changing to a tuple gives the desired output:

number=1
name="myname"
seconds=250
print "\t\t\t\n" \
% (number, name, seconds // 60, seconds % 60)



I have no idea why a list has that effect.

PS:  When writing XML and HTML, I use single quotes, so I don't have to 
escape double quotes:
print '\t\t\t\n' \
% (number, name, seconds // 60, seconds % 60)


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-05-19 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1636
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!newsfeeder.wxs.nl!textfeed1.on.meganewsservers.com!meganewsservers.com!feeder2.on.meganewsservers.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: NaN support etc.
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=iso-8859-1
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 38
Sender: [EMAIL PROTECTED]
Content-Transfer-Encoding: 8bit
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Thu, 19 May 2005 13:14:32 GMT
Xref: news.xs4all.nl comp.lang.python:378109

"Sébastien Boisgérault" <[EMAIL PROTECTED]> writes:

> Martin v. Löwis a écrit :
> > Andreas Beyer wrote:
> > > How do I find out if NaN, infinity and alike is supported on the
> current
> > > python platform?
[snip]
> 
> But, practically, I have never found a platform where
> the following fpconst-like code did not work:
> 
> import struct
> cast = struct.pack
> 
> big_endian = cast('i',1)[0] != '\x01'
> if big_endian:
>nan = cast('d', '\x7F\xF8\x00\x00\x00\x00\x00\x00')[0]
> else:
>nan = cast('d', '\x00\x00\x00\x00\x00\x00\xf8\xff')[0]
> 
> Can anybody provide an example of a (not too old or
> exotic) platform where this code does not behave as
> expected ?
> 
> Cheers,
> 
> SB
> 

I use fpconst too.  I've been concerned that its source home seems to
wander.  Any chance of it being added to the base distro?


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list

[no subject]

2005-05-19 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2056
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!fi.sn.net!newsfeed2.fi.sn.net!newsfeed3.funet.fi!newsfeed1.funet.fi!newsfeeds.funet.fi!newsfeed1.swip.net!swipnet!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: ElementTree and xsi to xmlns conversion?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 43
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Thu, 19 May 2005 13:24:58 GMT
Xref: news.xs4all.nl comp.lang.python:378110

"Fredrik Lundh" <[EMAIL PROTECTED]> writes:

[snip]
> 
> are you sure?  the prefix shouldn't matter; it's the namespace URI that's 
> important.
> if you're writing code that depends on the namespace prefix rather than the 
> name-
> space URI, you're not using namespaces correctly.  when it comes to 
> namespaces,
> elementtree forces you to do things the right way:
> 
> http://www.jclark.com/xml/xmlns.htm
> 
> (unfortunately, the XML schema authors didn't understand namespaces so they
> messed things up:
> http://www.w3.org/2001/tag/doc/qnameids-2002-04-30
> to work around this, see oren's message about how to control the 
> namespace/prefix
> mapping.  in worst case, you can manually insert xsi:-attributes in the tree, 
> and rely on
> the fact that the default writer only modifies universal names)
> 
>  
> 
> 
> 

First, thanks for ElementTree and cElementTree.  Second, I've read the
docs and see a lot of examples for building trees, but not a lot for
traversing parsed trees.  Questions:

1. Is there a good idiom for namespaces?  I'm currently doing things like:

UML='{href://org.omg/UML/1.3}'

packages=ns2.findall(UML+'Package')

2. Is there a similar idiom which works for Paths?   I've tried:

packages=pkg1.findall(UML+'Namespace.ownedElement/'+UML+'Package')

but haven't found the right combination, so I do step-at-a-time descent.

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-05-31 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1598
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!newsfeeder.wxs.nl!textfeed1.on.meganewsservers.com!meganewsservers.com!feeder2.on.meganewsservers.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: something like CPAN, PPMs?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 38
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Tue, 31 May 2005 18:58:32 GMT
Xref: news.xs4all.nl comp.lang.python:379601

Alex Gittens <[EMAIL PROTECTED]> writes:

> I'm new to Python from Perl, and loving it. Has there ever been any
> discussion of creating a similar resource as CPAN for Python, or a
> similar distribution method as PPMs? Seems like it would make a great
> language even better.
> 
> Alex
> -- 
> http://tangentspace.net/cz

CPAN:
1. A lot of the CPAN subject matter is in the base python installation.

2. Much of the remainder is associated with projects which are doing
   something else and happen to provide python bindings.

3. That leaves python-specific libraries as
   candidates for a CPAN.  See:
http://www.python.org/pypi
(see also http://www.python.org/sigs/catalog-sig/)
http://www.vex.net/parnassus/  (the original classic)

PPM:
The typical python install is:
   a) unzip and untar
   b) run "python setup.py install"

So what you are looking for is setup.py, and its module, distutils
http://docs.python.org/lib/module-distutils.html


   

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-10 Thread python-list-bounces+archive=mail-archive . com
#! rnews 2612
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: Generating HTML from python
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 70
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 10 Jun 2005 13:16:36 GMT
Xref: news.xs4all.nl comp.lang.python:381106

"Philippe C. Martin" <[EMAIL PROTECTED]> writes:

> PS: I am looking at the formatter module which seems to be related to HTML
> somehow, but without any code sample I'm a bit lost


As others have noted, if you need any computation at all, it is easier
to write directly in python.

I came to python from perl, where I used CGI.pm.  To get that effect,
I wrote my own CGIpm.py and used it for a while.  
http://www.seanet.com/~hgg9140/comp/index.html

But (at the suggestion of others in this newsgroup), I then tried
writing directly.  The net effect is trivial html generation, with all
the power of python at your fingertips.

Note: 
To save even more time, I made a CGI template that includes this main:

#
if __name__=="__main__":
mystart()
#cgi.print_environ_usage()
#cgi.print_environ()
form = cgi.FieldStorage()
try:
if len(form)==0:
send_form1()
else:
form_name=form['form_name'].value
if form_name=='form1':
recv_form1()
except StandardError, e:
print "\nERROR: %s\n" % e
myend()

To support a stateless world:

1. Each form has a send_xyz and recv_xyz function.  The end of each
recv_xyz decides what send_xyz to do next.

2. mystart and myend handle opening and closing the http and html.
They also handle state save/restore as needed (pickle or database).

> 
> 
> Philippe C. Martin wrote:
> 
> > Hi,
> > 
> > I wish to use an easy way to generate reports from wxPython and feel
> > wxHtmlEasyPrinting could be a good solution.
> > 
> > I now need to generate the HTML wxHtmlEasyPrinting can print: I need to
> > have a title followed by lines of text that do not look too ugly. If
> > possible I would like to use an existing module.
> > 
> > Q1) Is there such a module ?
> > Q2) Is my approach fairly good ?
> > 
> > Regards,
> > 
> > Philippe
> 

-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2005-06-10 Thread python-list-bounces+archive=mail-archive . com
#! rnews 1443
Newsgroups: comp.lang.python
Path: 
news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <[EMAIL PROTECTED]>
Subject: Re: python bytecode grammar
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Lines: 29
Sender: [EMAIL PROTECTED]
Organization: The Boeing Company
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Mime-Version: 1.0
Date: Fri, 10 Jun 2005 17:32:15 GMT
Xref: news.xs4all.nl comp.lang.python:381172

"M1st0" <[EMAIL PROTECTED]> writes:

> Ops yes is BNF :P Bacus Normal Form if I am not wrong...
> 
> However..
> 
> I'am tryng to recognizing patterns in a bytecoded file in orderd to
> optimize...
> 
> But I would like to "parse"  i.e reconstruct it in something like a
> tree..
> in order to apply rules on a tree recursively.
> 
> I have seen  compile.c in the Python dist...
> 

I've never looked, but I'm assuming it is defined in the compiler and
in the interpreter, and hopefully documented elsehwere, like:
http://python.fyxm.net/peps/pep-0330.html

Related:
http://mail.python.org/pipermail/python-dev/2004-December/050542.html
http://search.cpan.org/search?query=python%3A%3Abytecode&mode=all


-- 
[EMAIL PROTECTED]
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
-- 
http://mail.python.org/mailman/listinfo/python-list