[Tutor] What is "pythonic"?
tpc at csua.berkeley.edu
tpc at csua.berkeley.edu
Fri Oct 24 15:58:11 EDT 2003
at the last BayPIGgies meeting someone mentioned how Python is like
pseudocode that is executable. Pseudocode as you may know allows one to
conceptualize the logic of a particular program before settling down to
the nitty gritty of implementation in a particular language.
For loop to iterate over the items in a datastructure in Java:
for (i = 0; i < 10; i++)
{
System.out.println("hello world!")
}
and in Python to iterate:
myList = range(10)
for i in myList:
print "hello world!"
Notice the lack of curly braces. Python as you will find provides for
much cleaner, easier to read code.
On Fri, 24 Oct 2003, Tom Semple wrote:
> I've seen frequent reference on this list and in other Python resources to the adjective 'pythonic'. For now I am translating "pythonic" as "takes good advantage of the expressive qualities of the Python language". However, as a newcomer to the language, I'm finding this translation doesn't always allow me to understand the point that is being made (especially when there is no attempt to elaborate beyond a bland assertion that some code is or is not 'pythonic'). Can anyone suggest some resources that have a number of code examples that illustrate 'pythonic' vs. 'non-pythonic' style?
>
> On a related question, I'd like to know more about the philosophy and history of Python. For example, I came across a quote "we are all consenting adults here" I think in explaining why it is not necessary to have type declaration statements in Python, in contrast to other strongly-typed languages. I'm looking for more of that sort of material.
>
> Thanks,
> Tom
>
More information about the Tutor
mailing list