Tags:
create new tag
, view all tags
Python seems like an interesting programming language with a reputation for being easy to use and object oriented. (In some cases, it seems somewhat a competitor to Perl, although Python strikes me as much more of a general purpose language.)

Depite the concern in some quarters about Python's block structuring via indentation, significant projects have and are being done in Python, including Zope, Leo, and the ldp's Lampadas project (in that case, despite the original intent to do it in Perl). (Because Leo is written in Python, the Leo developer, Ed Ream, has taken special care to preserve the indentation properly in Leo so that the block structure is maintained properly.)

See also ComparingPerlPythonRuby.

See AboutThesePages.

Contents

Notes

Here's a post from a Slashdot thread on Python that points out some potential problems. (Some of these are addressed further down in the thread.):

Pet Python problems (Score:2, Offtopic) by Ed Avis

I've been using Python for a few months now. I hope people won't mind if I post a shopping list of what seem to be missing features in the language, and ask if there is a way round them.

- Python has 'break' and 'continue' like C. But these only affect the innermost loop. Is there a way to break out of an enclosing loop? (In Perl you can label a loop and then say 'next LABEL', etc.)

- Failing that, is there a way to get goto statements in Python? They can sometimes be an elegant way to express something, contrary to popular myth. (Eg tail recursion.)

- How can I pass a variable by reference? For example, to take a reference to a string, pass it to a function and have that function modify the string passed in. More generally, is there a way to store references?

- Python advertises its support for first-class functions, but I can't seem to get closures to work. The 'lambda' keyword won't accept assignment or even sequencing inside the function body. So anonymous functions you might want to pass around can't do much beyond trivial operations. You can get around this to some extent by making named functions in every case and passing those around, but even then they don't seem to act properly as closures, picking up variables from their local scope. (I'm using Python 2.2.1 BTW.)

- Is there a do/while statement in Python? Plain 'while' is there but occasionally an 'at least once' loop is what you need. Is there an addon package or library for Python that provides a 'do' construct?

As you may have guessed, these are the things I really miss in going from Perl to Python. The cleaner syntax isn't a big enough payoff for going without some fairly important language features. The project Vyper sounded very promising in its attempt to add real lexical scoping and functional programming features to Python, but it doesn't seem to be active any longer. A real pity. In the meantime, where I have a choice, I'll keep using Perl, despite its syntactic oddities and historical baggage. -- Ed Avis

Resources

See ResourceRecommendations. Feel free to add additional resources to these lists, but please follow the guidelines on ResourceRecommendations including ResourceRecommendations#Guidelines_for_Rating_Resources.

Recommended

Recent (ca July, 2003)

  • Python Essays; Guido van Rossum — "In this directory I place short essays (anything from 500 to 5000 words) on various Python subjects. See also a collection of presentations I have given. See also my blog at artima.com."
    • Foreword for "Programming Python" (1st ed.); Guido van Rossum: "This is the foreword I wrote for Mark Lutz' book "Programming Python" (1st ed.), published by O'Reilly."

  • Dive Into Python: Python for experienced programmers: 1.3. Documenting functions — another online resource I want to explore

  • [[http://www.effbot.org][]]

Programming by Contract allows a programmer to document a function/class with statements describing behavior.

The most famous use/example of contracts is in the language Eiffel - a good introduction to programming contracts has been written by the people who wrote Eiffel.

  • WxPyWiki — a wiki devoted to wxpython

Older

Welcome to the Python Cookbook! This is a collaborative collection of techniques which hosts your contributions to Python lore. The partnership between ActiveState and O'Reilly provides the resources to bring this collection to life in a printed volume, The Python Cookbook.

Python Cookbook code is freely available for use and review.

We invite you to contribute code, comments, and ratings for recipes.

Recommended for Specific Needs

Recommended by Others

No Recommendation

  • (rhk) Slashdot: The Python Cookbook; Posted by timothy on Wednesday October 09,2002 -- a Slashdot thread, somewhat interesting and some useful links -- didn't finish reading

Contributors

  • () RandyKramer - 28 May 2002
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>

Page Ratings

Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2003-09-17 - RandyKramer
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look