If you are interested in learning another tool, please, start with
Python. If you are interested in scripting UNIX, Perl is a fine
choice. There prevalence matters, and quite a bit. But sys admins
are usually very Perl-centric, and in my experience monolingual, and a
bit of an insular community
Before you hit the debugger, it might be a good idea to just run the
script normally, either at the command line, or inside IDLE/Pythonwin.
Doing so will spit out:
Traceback (most recent call last):
File interactive input, line 1, in ?
NameError: name 'ftplib' is not defined
Because you
If I'm not mistaken, that's the Pythonwin debugger spitting messages
to the interactive prompt. I just used it to step through your your
games framework example :)
Being the first time I'd used any Python debugger, it didn't occur to
me that the look of it was non-standard.
I actually got the
Turbogears seconded. It's a really great collection of tools.
As an alternative, you may also want to check out Nevow. From the webpage:
Nevow includes LivePage, a two-way bridge between JavaScript in a
browser and Python on the server. For 0.3, LivePage has been updated
to operate on
Probably the most useful library from the wwwsearch page Danny pointed
you to is the cookielib, which is built into Python as of 2.3 or 2.4.
The most useful because you can't scrape by without it on most sites,
and cookies are really no fun to handle manually Login and forms can
largely be
Since when is elegance a dirty word?
Elegance is the soul of good programming. A simple and graceful
solution to the widest number of cases, efficient and easy to
understand in application. Sometimes subtle, but always beautiful.
In language design, software architecture, algorithms, it is
Sorry. *blush* That was some late Friday night craziness. I just
looked at the code being discussed:
retList=[word[pos]+item for item in permute3(word[0:pos]+word[pos+1:])]
And really didn't want to anybody to confuse that with Python's idea
of elegance.
List comprehensions can get pretty
On 10/21/05, Kent Johnson [EMAIL PROTECTED] wrote:
For simple examples just look at Python's built in string, list and dict
classes.
-Using- OOP isn't the problem :) It's impossible to ignore it's usefulness when
programming in Python. But getting from there to thinking non-procedurally is,
as
It's not in direct answer to your question, but a real short answer is
Python doesn't need 'or die' here. It throws exceptions gleefully
whenever it encounters an error:
f = open('no_such_file')
Traceback (most recent call last):
File interactive input, line 1, in ?
IOError: [Errno 2] No
I've been reading about composition vs inheritance, and went back to
Learning Python to look at something I found very confusing a year
ago. Turns out I still find it very confusing :)
The code at the bottom was taken from the OOP chapter, it's a solution
to one of the end-of-chapter problems.
Hi Alan, thanks for taking the time to answer so thoroughly. I've
responded to a few things below. But let me say right off I have
gone through the OOP section in your excellent tutor. It was one of
my main resources learning Python. I actually have Bertand Meyer's
book here (and have written
You could try: http://www.aminus.org/rbre/python/cleanhtml.py
YMMV, as the kids say. But I did choose this over BeautifulSoup or
Strip-o-gram to do this particular thing. I don't remember -why- I
chose it, but there you go. Easy enough to test all three :)
Oh, and if you just want a whole
Well, on the bright side, at least Python is being taught in schools.
My younger sister is a CS major just starting her programming courses,
and it's Java/C++ all the way. I am becoming convinced that lines of
code are not only related to the number of bugs and development speed,
but learning
It's way past my bedtime, but any use of numpy/numarray that involves
two nested for loops to step over each element is the wrong solution
:) You need to figure out how to get rid of that inner for.
That is what is slowing you down.
Compare these two ways to multiply a 1000 element array by 100.
If it makes you feel any better, this isn't an easy problem to get 100%
right, traditionally. Heck, it might not even be possible.
A series of compromises might be the best you can hope for.
Some things to think about, however. Can you choose the
characters you want, instead of the (many, many)
Just want to add a little something here, because reading over this thread, I think there may have been some confusion:
Kent wrote:
for e in saveRemovedForLaterL: L.append(e)could be
L.extend(e)
I think he might have meant:
for e in saveRemovedForLaterL: L.append(e)could be
Oops, Paul is probably right. I thought urllib2 opened local
files in the absence of an identifier like http://. Bad assumption on my part. I remembered that
behavior from somewhere else, maybe urllib.
That path beginning with \\C:\\ could still bite you, however. Good luck,
Andrew
Thanks for the recommendations, Kent.
Kent wrote:
How could I forget the Gang of Four? This is the book that started the Design Patterns movement.
Gamma, Helm, Johnson Vlissides, Design Patternshttp://www.aw-bc.com/catalog/academic/product/0,1144,0201633612,00.html
I probably shouldn't forget
Thanks Danny. That outline of How to Solve It reminded me of an idea that resonated strongly with me in
Programming Pearls, and I just looked it up and sure enough, Bentley was referencing the same Polya book:
Most of the structures exemplify what Polya calls the Inventor's
Paradox in his How To
I was just thinking about Jon Bentley's Programming Pearls,
and how much I really liked it. Nothing has really changed since
1986, and all the pseudo code translated nicely into Python. It
was by far the most fun I've had reading any book about
programming. Especially solving problems he presented
I've used CherryPy on a couple of projects now. I use it with
HTMLTemplate
(http://freespace.virgin.net/hamish.sanderson/htmltemplate.html) and
SQLObject (http://sqlobject.org/).
This has the advantage of being about as Pythonic as you can get, since
everything you manipulate is represented as
Have you benchmarked it yet? 4000 lines isn't very many, even for
an older machine. Starting the Python interpreter usually takes
most of the time with simple scripts like this. Honestly,
benchmark :)
You might find it easier to do::
interface_list = INI.items(section)for i in interface_list:
22 matches
Mail list logo