Does python have one way of doing things?

Posted by gath on Stack Overflow See other posts from Stack Overflow or by gath
Published on 2010-04-08T11:30:44Z Indexed on 2010/04/08 11:33 UTC
Read the original article Hit count: 411

Filed under:
|

I have always seen in python articles/books that python is simple and it has only one way of doing things. I would like someone to explain to me this concept keeping in mind the example below, if i wanted to get the min and max values of sequence i would do the following;

seq=[1,2,3,4,5,6]

min(seq) #1

max(seq) #6

but i can also do this;

seq[:1]  #1

seq[-1]  #6

surely this are two ways of doing one simple thing. This confuses me a bit.

Gath

© Stack Overflow or respective owner

Related posts about python

Related posts about concepts