473,748 Members | 8,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beautiful Code in Python?

js
Hi,

Have you ever seen Beautiful Python code?
Zope? Django? Python standard lib? or else?

Please tell me what code you think it's stunning.
Mar 2 '08 #1
8 2771
On Mar 2, 5:23 pm, js <ebgs...@gmail. comwrote:
Hi,

Have you ever seen Beautiful Python code?
Zope? Django? Python standard lib? or else?

Please tell me what code you think it's stunning.
The doctest module in the standard library.

M.S.
Mar 2 '08 #2
On Mon, 3 Mar 2008 01:23:32 +0900, js <eb*****@gmail. comwrote:
>Hi,

Have you ever seen Beautiful Python code?
Zope? Django? Python standard lib? or else?

Please tell me what code you think it's stunning.
Just about any Python code I look at.
Mar 2 '08 #3
On Mar 2, 12:01*pm, John DeRosa <stug...@qwest. netwrote:
On Mon, 3 Mar 2008 01:23:32 +0900, js <ebgs...@gmail. comwrote:
Hi,
Have you ever seen Beautiful Python code?
Zope? Django? Python standard lib? or else?
Please tell me what code you think it's stunning.

Just about any Python code I look at.
Decorators, with, and namedtuple.
Mar 2 '08 #4
js a écrit :
Hi,

Have you ever seen Beautiful Python code?
Zope? Django? Python standard lib? or else?

Please tell me what code you think it's stunning.
FormEncode has some very interesting parts IMHO.
Mar 3 '08 #5
On Mar 2, 8:35*am, Michele Simionato <michele.simion ...@gmail.com>
wrote:
On Mar 2, 5:23 pm, js <ebgs...@gmail. comwrote:
Hi,
Have you ever seen Beautiful Python code?
Zope? Django? Python standard lib? or else?
Please tell me what code you think it's stunning.

The doctest module in the standard library.

*M.S.
The first thing of beauty I found in Python (coming from C, C++, and
perl) was the way Python handled variables, or as someone recently
described them, names.

Python's "for" statement is always beautiful to look at. Especially
when someone uses the else clause rather than trying to detect if the
list was exhausted. I sometimes avoid using the comprehensions just to
get an excuse to write another for loop in Python. There can never be
enough for loops written in Python!

Also, Python's iterator interface is by far the most beautiful thing I
have ever seen in the world of programming. Of course, the reason why
the for loop is so beautiful is because iterators are so beautiful.
Mar 3 '08 #6
Please tell me what code you think it's stunning.

Pexpect is (almost) pseudocode is (almost) poetry to my ears. And
there's a lot of narrative in it as well:

http://pexpect.svn.sourceforge.net/v...e=text%2Fplain
Mar 3 '08 #7
On Mar 2, 1:18*pm, castiro...@gmai l.com wrote:
On Mar 2, 12:01*pm, John DeRosa <stug...@qwest. netwrote:
On Mon, 3 Mar 2008 01:23:32 +0900, js <ebgs...@gmail. comwrote:
>Hi,
>Have you ever seen Beautiful Python code?
>Zope? Django? Python standard lib? or else?
>Please tell me what code you think it's stunning.
Just about any Python code I look at.

Decorators, with, and namedtuple.
<running gag>Oh yeah, and variable arguments and keyword
dictionaries.<t hroat clear/></running gag>
Mar 9 '08 #8
On Mar 9, 6:44*pm, castiro...@gmai l.com wrote:
On Mar 2, 1:18*pm, castiro...@gmai l.com wrote:
On Mar 2, 12:01*pm, John DeRosa <stug...@qwest. netwrote:
On Mon, 3 Mar 2008 01:23:32 +0900, js <ebgs...@gmail. comwrote:
Hi,
Have you ever seen Beautiful Python code?
Zope? Django? Python standard lib? or else?
Please tell me what code you think it's stunning.
Just about any Python code I look at.
Decorators, with, and namedtuple.

<running gag>Oh yeah, and variable arguments and keyword
dictionaries.<t hroat clear/></running gag>
If you're C++, garbage collection. How's the cycle detector? The
pages and pages get pretty specific.
Mar 21 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
3528
by: vinjvinj | last post by:
I haven't used an IDE in a long time but gave wing ide a try because I wanted the same development platform on Linux and Windows. I'm currently using Ultraedit and it works fine but needed something more portable as I'm moving my main platform over to Ubuntu. I first tried jedit and was reasonably happy with it but it felt slow and it did not have a native look and feel to it. It was really hard on the eyes. I was impressed! The UI...
8
1474
by: Gekitsuu | last post by:
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 script like: use strict; use WWW::Mechanize; use CGI;
3
1275
by: Max | last post by:
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 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...
1
2732
by: Tempo | last post by:
Heya. I have never used a module/script before, and the first problem I have run into is that I do not know how to install a module/script. I have downloaded Beautiful Soup, but how do I use it in one of my own programs? I know that I use an "include" statement, but do I first need to make a copy of BeautifulSoup.pyc or BeautifulSoup.py into the Python directory? Thanks in advanced for any and all help that you may provide. Many thanks.
0
679
by: Anthra Norell | last post by:
Hi, Martin, SE is a stream editor that does not introduce the overhead and complications of overkill parsing. See if it suits your needs: http://cheeseshop.python.org/pypi/SE/2.2%20beta <EAT # delete all unmatched input "~(?i)<a.*?href.*?>~==\n" # keep hrefs and add a new line
3
10748
by: cjl | last post by:
I am learning python and beautiful soup, and I'm stuck. A web page has a table that contains data I would like to scrape. The table has a unique class, so I can use: soup.find("table", {"class": "class_name"}) This isolates the table. So far, so good. Next, this table has a certain number of rows (I won't know ahead of time how many), and each row has a set number of cells (which will be constant).
0
8823
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9530
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.