Your beloved python features

2 views
Skip to first unread message

Julian

unread,
Feb 4, 2010, 6:03:08 PM2/4/10
to
Hello,

I've asked this question at stackoverflow a few weeks ago, and to make
it clear: this should NOT be a copy of the stackoverflow-thread
"hidden features of Python".

I want to design a poster for an open source conference, the local
usergroup will have a table there, and in the past years there were
some people that came to the python-table just to ask "why should I
use python?".

For those guys would be a poster quite cool which describes the most
popular and beloved python features.

So, may you help me please? If there's a similar thread/blogpost/
whatever, please give it to me, google couldn't.

Regards
Julian

R Fritz

unread,
Feb 4, 2010, 6:10:55 PM2/4/10
to
My favorite feature is its readability. It's as near to pseudo-code
as any language we have, and that's valuable in open source projects
or when I return to code to modify it.

Paul Rubin

unread,
Feb 4, 2010, 6:20:01 PM2/4/10
to
Julian <mail...@julianmoritz.de> writes:
> I want to design a poster for an open source conference, the local
> usergroup will have a table there, and in the past years there were
> some people that came to the python-table just to ask "why should I
> use python?".

It's terrible, but all the alternatives are even worse. ;-)

Terry Reedy

unread,
Feb 4, 2010, 7:12:27 PM2/4/10
to pytho...@python.org
Iterators, and in particular, generators.
A killer feature.

Terry Jan Reedy

Bruce C. Baker

unread,
Feb 4, 2010, 8:45:48 PM2/4/10
to
"Terry Reedy" <tjr...@udel.edu> wrote in message
news:mailman.1929.1265328...@python.org...

> Iterators, and in particular, generators.
> A killer feature.
>
> Terry Jan Reedy
>

Neither unique to Python.

And then're the other killer "features" superfluous ":"s and rigid
formatting!


Sean DiZazzo

unread,
Feb 4, 2010, 9:26:06 PM2/4/10
to

I love list comprehensions, but am currently falling for 'with'.

~Sean

Arnaud Delobelle

unread,
Feb 5, 2010, 2:12:05 AM2/5/10
to

* simplicity
* documentation - some criticise it, I love it.
* duck typing
* batteries included

And lots more!

--
Arnaud

Paul Rubin

unread,
Feb 5, 2010, 2:19:46 AM2/5/10
to
Julian <mail...@julianmoritz.de> writes:
> I want to design a poster for an open source conference, the local
> usergroup will have a table there, and in the past years there were
> some people that came to the python-table just to ask "why should I
> use python?".

- Very easy to learn, at least for the not-too-hairy fragment
- some features like generators are advanced compared with some
other languages, yet still easy to use
- pleasant-to-use syntax (yes, the indentation stuff that everyone
is freaked out by at first) and well-evolved library makes coding
very productive and enjoyable
- reasonably good documentation
- large and friendly user/developer community

George Sakkis

unread,
Feb 5, 2010, 2:25:59 AM2/5/10
to
On Feb 5, 2:45 am, "Bruce C. Baker" <b...@undisclosedlocation.net>
wrote:

> "Terry Reedy" <tjre...@udel.edu> wrote in message


>
> news:mailman.1929.1265328...@python.org...
>
> > Iterators, and in particular, generators.
> > A killer feature.
>
> > Terry Jan Reedy

+1, iterators/generators is among Python's best features for me too.

> Neither unique to Python.

Can you name a single feature that is unique to a language, Python or
other ? Every idea that's any good has been copied over, usually more
than once.

> And then're the other killer "features" superfluous ":"s and rigid
> formatting!

I'll give the benefit of doubt and assume you're joking rather than
trolling.

George

Ethan Furman

unread,
Feb 4, 2010, 6:55:30 PM2/4/10
to pytho...@python.org

Martin P. Hellwig

unread,
Feb 5, 2010, 6:09:16 AM2/5/10
to
On 02/04/10 23:03, Julian wrote:
<cut>

> For those guys would be a poster quite cool which describes the most
> popular and beloved python features.

That it is ego-orientated programming ;-)
http://mail.python.org/pipermail/python-announce-list/2009-April/007419.html

--
mph

Jean-Michel Pichavant

unread,
Feb 5, 2010, 6:10:57 AM2/5/10
to Ethan Furman, pytho...@python.org
Ethan Furman wrote:
> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/choose_python.pdf
>
"Choose metaclasses if you don�t value your sanity."

That remembers me the time when it took me 4 hours to write a ten lines
metaclass :o)

JM

Daniel Fetchinson

unread,
Feb 5, 2010, 6:42:47 AM2/5/10
to Python
> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/choose_python.pdf

This is effin hilarious! Should be either linked or stored on python.org

Cheers,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown

apeach

unread,
Feb 5, 2010, 7:16:16 AM2/5/10
to
I love intuitive type recognition.

no need to 'DIM everything AS Integer' etc.!

bartc

unread,
Feb 5, 2010, 7:18:46 AM2/5/10
to

"R Fritz" <rfri...@gmail.com> wrote in message
news:e97ff208-d08e-4934...@l24g2000prh.googlegroups.com...

> My favorite feature is its readability. It's as near to pseudo-code
> as any language we have, and that's valuable in open source projects
> or when I return to code to modify it.

That might be true when used to code actual algorithms using basic features.

But a lot of Pythonisms would appear mysterious to someone who doesn't know
the language (for example, what does :: mean in an array index).

Or perhaps pseudo-code is much more advanced these days...

--
bartc

Bruno Desthuilliers

unread,
Feb 5, 2010, 8:43:50 AM2/5/10
to
apeach a �crit :

> I love intuitive type recognition.
>
> no need to 'DIM everything AS Integer' etc.!
>

not to mention the ever hilarious (that is, when you don't have to
maintain it) typical Java idiom:

EveryThing theEveryThing = new EveryThing();

Bruno Desthuilliers

unread,
Feb 5, 2010, 8:45:17 AM2/5/10
to
Julian a �crit :

> Hello,
>
> I've asked this question at stackoverflow a few weeks ago, and to make
> it clear: this should NOT be a copy of the stackoverflow-thread
> "hidden features of Python".
>
> I want to design a poster for an open source conference, the local
> usergroup will have a table there, and in the past years there were
> some people that came to the python-table just to ask "why should I
> use python?".
>
> For those guys would be a poster quite cool which describes the most
> popular and beloved python features.

My all-time favorite Python feature : it fits my brain.

Roald de Vries

unread,
Feb 5, 2010, 8:49:53 AM2/5/10
to pytho...@python.org

My reasoning: I needed a language more powerful than bash, but more
portable and faster to develop (at least small scripts) than C/C++. So
I needed a scripting language. Python, Ruby, Perl, Tcl, ...?

Python seems to be the language with the most libraries available,
programs written in it, OS-support (even runs on my smartphone), has a
good data-model, has a good interactive shell (iPython).

Jean-Michel Pichavant

unread,
Feb 5, 2010, 9:42:44 AM2/5/10
to Bruno Desthuilliers, pytho...@python.org
Python is simple ... no offense Bruno :D

JM

(sorry couldn't help)

Grant Edwards

unread,
Feb 5, 2010, 10:24:04 AM2/5/10
to
On 2010-02-04, Julian <mail...@julianmoritz.de> wrote:

> I've asked this question at stackoverflow a few weeks ago, and
> to make it clear: this should NOT be a copy of the
> stackoverflow-thread "hidden features of Python".
>
> I want to design a poster for an open source conference, the
> local usergroup will have a table there, and in the past years
> there were some people that came to the python-table just to
> ask "why should I use python?".
>
> For those guys would be a poster quite cool which describes
> the most popular and beloved python features.

In the fine old tradition:

Python: It sucks less.


A lot less.


--
Grant Edwards grante Yow! You should all JUMP
at UP AND DOWN for TWO HOURS
visi.com while I decide on a NEW
CAREER!!

Bruno Desthuilliers

unread,
Feb 5, 2010, 10:49:08 AM2/5/10
to
Jean-Michel Pichavant a �crit :

> Bruno Desthuilliers wrote:
>>
>> My all-time favorite Python feature : it fits my brain.
> Python is simple ... no offense Bruno :D

!-)

But FWIW, that's exactly the point : even a stoopid like me can manage
to learn and use Python, and proceed to write working apps without
spending more time reading the doc than actually solving the problem.

mk

unread,
Feb 5, 2010, 12:29:07 PM2/5/10
to pytho...@python.org
Ethan Furman wrote:

> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/choose_python.pdf
>

Choose to get your difficult questions about threads in Python ignored.
Oh well..

mk

unread,
Feb 5, 2010, 12:30:50 PM2/5/10
to pytho...@python.org
Julian wrote:

> For those guys would be a poster quite cool which describes the most
> popular and beloved python features.

Dictionaries.

A workhorse of Python, by far the most useful data structure.


Bruce C. Baker

unread,
Feb 5, 2010, 4:22:25 PM2/5/10
to

"George Sakkis" <george...@gmail.com> wrote in message
news:de06116c-e77c-47c4...@j31g2000yqa.googlegroups.com...


I'll give the benefit of doubt and assume you're joking rather than
trolling.

George

*************************************************************

Not trolling, my friend!

GvR got it right when he discarded the superfluous semicolons from the ends
of statements--and then he ADDS superfluous colons to the ends of control
statements? It will probably be as much of a shock to you as it was to me
when I learned after studying parsing that colons, semicolons, "then"'s and
"do"'s, etc., are simply noise tokens that serve no purpose except to
clutter up the source.

As for enforced indentation, back in the late 60's when I was a programming
newbie I remember thinking how cool it would be to just indent the
statements controlled by for loops (we didn't have none of them fancy while
loops in FORTRAN back then! :-) ) Not too long after that I saw the havoc
that a buggy editor could wreak on nicely-formatted source. :-( Formatting
held hostage to a significant, invisible whitespace char? An inevitable
accident waiting to happen! Not good, Guido; not good at all.

That'll do for starters. :-)

Message has been deleted

Steven D'Aprano

unread,
Feb 5, 2010, 5:52:24 PM2/5/10
to
On Fri, 05 Feb 2010 18:29:07 +0100, mk wrote:

> Ethan Furman wrote:
>
>> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/
choose_python.pdf


>>
>>
> Choose to get your difficult questions about threads in Python ignored.
> Oh well..

With an attitude like that, you're damn lucky if you don't get kill-
filed. It was SIX MINUTES since you posted your question about timers,
what did you expect?

Threads are hard, and many people don't use them at all. You might never
get an answer, even without alienating people. Complaining after six DAYS
might be acceptable, if you do it with a sense of humour, but after six
minutes?

Advice on public forums is free, but it doesn't come with an guaranteed
response time. If you want a Service Level Agreement, you will need to
pay somebody for it.

--
Steven

Steven D'Aprano

unread,
Feb 5, 2010, 6:01:46 PM2/5/10
to
On Fri, 05 Feb 2010 15:22:25 -0600, Bruce C. Baker wrote:

> GvR got it right when he discarded the superfluous semicolons from the
> ends of statements--and then he ADDS superfluous colons to the ends of
> control statements?

They're not superfluous, they have a real, practical use.


> It will probably be as much of a shock to you as it
> was to me when I learned after studying parsing that colons, semicolons,
> "then"'s and "do"'s, etc., are simply noise tokens that serve no
> purpose except to clutter up the source.

Incorrect, they do have a use. Hint: source code isn't just read by
parsers.

> As for enforced indentation, back in the late 60's when I was a
> programming newbie I remember thinking how cool it would be to just
> indent the statements controlled by for loops (we didn't have none of
> them fancy while loops in FORTRAN back then! :-) ) Not too long after
> that I saw the havoc that a buggy editor could wreak on nicely-formatted
> source. :-(

As opposed to how resistant source code is to buggy editors that make
other changes to source code.

If your editor flips the order of characters, or turns the digit "4" into
"7", or deletes braces, or inserts "#" characters at the start of lines,
you would dump the editor in a second. But if the editor inserts or
removes whitespace, we're supposed to continue using the editor and
change the language?


> Formatting held hostage to a significant, invisible
> whitespace char?

It's not invisible. You can see it by noticing the space between the left
margin and the start of non-whitespace text. Can you see the difference
between these?

hello world

hello world

Of course you can, unless your News reader or mail client is buggy. If it
is deleting whitespace at the start of lines, how can you trust it not to
delete anything else?

Trailing spaces and tabs, on the other hand, *are* invisible. But they're
also insignificant, and so don't matter.

(Except for one little tiny corner case, which I shall leave as an
exercise for the advanced reader.)

--
Steven

Tim Chase

unread,
Feb 5, 2010, 7:00:44 PM2/5/10
to Steven D'Aprano, pytho...@python.org
Steven D'Aprano wrote:
> Trailing spaces and tabs, on the other hand, *are* invisible. But they're
> also insignificant, and so don't matter.
>
> (Except for one little tiny corner case, which I shall leave as an
> exercise for the advanced reader.)

Drat, now I'm gonna be up at odd hours tonight dredging my brain
for such corner cases. My catalog so far:

- triple-quoted multi-line strings

- "\" line-continuations don't work with trailing whitespace
(though Vim's syntax highlighting flags them, changing their
color if there's whitespace afterwards)

- files that read themselves (or perhaps depend on
introspection/debugging modules to read themselves)

Any others that I missed?

-tkc


Steve Holden

unread,
Feb 6, 2010, 7:54:54 PM2/6/10
to pytho...@python.org

Paul Rubin

unread,
Feb 6, 2010, 8:21:15 PM2/6/10
to
Steve Holden <st...@holdenweb.com> writes:
>> EveryThing theEveryThing = new EveryThing();
> http://www.artima.com/weblogs/viewpost.jsp?thread=42242

Pretty cool! I see your blog post criticizing Java's lack of type
inference, and then immediately adjacent to the post there's a banner ad
for a book called "Programming in Scala". I think I am getting a mixed
message ;-)

Schif Schaf

unread,
Feb 7, 2010, 12:04:44 AM2/7/10
to
On Feb 5, 8:49 am, Roald de Vries <r...@roalddevries.nl> wrote:

> My reasoning: I needed a language more powerful than bash, but more  
> portable and faster to develop (at least small scripts) than C/C++. So  
> I needed a scripting language. Python, Ruby, Perl, Tcl, ...?
>
> Python seems to be the language with the most libraries available,

I like Python a lot. That said, it looks like Perl's CPAN currently
has approximately double the number of packages in the Cheeseshop.

I'm guessing the CPAN is still growing, but I don't know how fast it
is growing compared to the Cheeseshop.

I won't venture a guess as to which has a higher percentage of older
unmaintained packages.

Anssi Saari

unread,
Feb 7, 2010, 7:21:17 PM2/7/10
to
Julian <mail...@julianmoritz.de> writes:

> I've asked this question at stackoverflow a few weeks ago, and to make
> it clear: this should NOT be a copy of the stackoverflow-thread
> "hidden features of Python".

Thanks for the hint, interesting stuff in there.

> For those guys would be a poster quite cool which describes the most
> popular and beloved python features.

For me as an electronics HW guy, I really like that I can easily
handle binary data without doing tedious and error prone shifting and
anding and oring.

mk

unread,
Feb 8, 2010, 12:07:56 PM2/8/10
to pytho...@python.org
Steven D'Aprano wrote:
> On Fri, 05 Feb 2010 18:29:07 +0100, mk wrote:
>
>> Ethan Furman wrote:
>>
>>> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/
> choose_python.pdf
>>>
>> Choose to get your difficult questions about threads in Python ignored.
>> Oh well..
>
> With an attitude like that, you're damn lucky if you don't get kill-
> filed. It was SIX MINUTES since you posted your question about timers,
> what did you expect?

I didn't expect immediate answer to this particular question. I have
repeatedly asked many questions about threads in the past, and IIRC
every one of them was ignored.

>
> Threads are hard, and many people don't use them at all. You might never
> get an answer, even without alienating people. Complaining after six DAYS
> might be acceptable, if you do it with a sense of humour, but after six
> minutes?

Well, it's 4 days now. I would be happy to get 50% response rate.
Apparently nobody is really using threads.

regards,
mk

geremy condra

unread,
Feb 8, 2010, 3:06:26 PM2/8/10
to mk, pytho...@python.org
On Mon, Feb 8, 2010 at 12:07 PM, mk <mrk...@gmail.com> wrote:
> Steven D'Aprano wrote:
>>
>> On Fri, 05 Feb 2010 18:29:07 +0100, mk wrote:
>>
>>> Ethan Furman wrote:
>>>
>>>> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/
>>
>> choose_python.pdf
>>>>
>>> Choose to get your difficult questions about threads in Python ignored.
>>> Oh well..
>>
>> With an attitude like that, you're damn lucky if you don't get kill-
>> filed. It was SIX MINUTES since you posted your question about timers,
>> what did you expect?
>
> I didn't expect immediate answer to this particular question. I have
> repeatedly asked many questions about threads in the past, and IIRC every
> one of them was ignored.
>
>>
>> Threads are hard, and many people don't use them at all. You might never
>> get an answer, even without alienating people. Complaining after six DAYS
>> might be acceptable, if you do it with a sense of humour, but after six
>> minutes?
>
> Well, it's 4 days now. I would be happy to get 50% response rate. Apparently
> nobody is really using threads.
>
> regards,
> mk

I use threads.

Geremy Condra

MRAB

unread,
Feb 8, 2010, 5:50:02 PM2/8/10
to pytho...@python.org
geremy condra wrote:
> On Mon, Feb 8, 2010 at 12:07 PM, mk <mrk...@gmail.com> wrote:
>> Steven D'Aprano wrote:
>>> On Fri, 05 Feb 2010 18:29:07 +0100, mk wrote:
>>>
>>>> Ethan Furman wrote:
>>>>
>>>>> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/
>>> choose_python.pdf
>>>> Choose to get your difficult questions about threads in Python ignored.
>>>> Oh well..
>>> With an attitude like that, you're damn lucky if you don't get kill-
>>> filed. It was SIX MINUTES since you posted your question about timers,
>>> what did you expect?
>> I didn't expect immediate answer to this particular question. I have
>> repeatedly asked many questions about threads in the past, and IIRC every
>> one of them was ignored.
>>
>>> Threads are hard, and many people don't use them at all. You might never
>>> get an answer, even without alienating people. Complaining after six DAYS
>>> might be acceptable, if you do it with a sense of humour, but after six
>>> minutes?
>> Well, it's 4 days now. I would be happy to get 50% response rate. Apparently
>> nobody is really using threads.
>>
>> regards,
>> mk
>
> I use threads.
>
So do I, where appropriate.

Aahz

unread,
Feb 8, 2010, 5:50:21 PM2/8/10
to
In article <28c6967f-7637-4823...@o28g2000yqh.googlegroups.com>,

Julian <mail...@julianmoritz.de> wrote:
>
>I want to design a poster for an open source conference, the local
>usergroup will have a table there, and in the past years there were
>some people that came to the python-table just to ask "why should I
>use python?".

Readability
--
Aahz (aa...@pythoncraft.com) <*> http://www.pythoncraft.com/

import antigravity

Steven D'Aprano

unread,
Feb 8, 2010, 8:31:35 PM2/8/10
to
On Mon, 08 Feb 2010 18:07:56 +0100, mk wrote:

>> Threads are hard, and many people don't use them at all. You might
>> never get an answer, even without alienating people. Complaining after
>> six DAYS might be acceptable, if you do it with a sense of humour, but
>> after six minutes?
>
> Well, it's 4 days now. I would be happy to get 50% response rate.
> Apparently nobody is really using threads.

Please see my response to your post "timer for a function".

--
Steven

Julian

unread,
Feb 10, 2010, 7:40:39 AM2/10/10
to
hello there,

thanks everyone for that many answers! I'm lying in bed with a bad
cold, so I'll get through all the posts on the weekend.

regards
Julian

jhermann

unread,
Feb 11, 2010, 8:34:26 AM2/11/10
to
$ python -c "import this"
Reply all
Reply to author
Forward
0 new messages