reading file to list
xahlee at gmail.com
Tue Jan 20 04:39:45 CET 2009
On Jan 19, 4:49 pm, "Rhodri James" <rho... at wildebst.demon.co.uk>
> On Sun, 18 Jan 2009 08:31:15 -0000, Xah Lee <xah... at gmail.com> wrote:
> > On Jan 17, 10:25 am, Tino Wildenhain <t... at wildenhain.de> wrote:
> >> > [[int(x) for x in line.split()] for line in open("blob.txt")]
> > Nice (python code).
> > Few comments:
> > • the above code is borderline of atypical. e.g. it is not a average
> > python code would produce or one'd seen in corporate python code.
> I can't imagine why not.
consider code produced by corporations, as opposed to with respect to
some academic or philsophical logical analysis. Looked in another way,
consider if we can compile stat of all existing pyhton code used in
real world, you'll find the above style is rarely used.
in a logical analysis, each lang fanatics will actively sell certain
style of construction, but that's just not the way code in the real
world are. Ample examples can be found especially in other cultish
lang groups such as lisp, perl, etc. (less of this phenomenon is found
create fancy constructions in the name of improvement or esthetics or
weird philosophy in the first place.)
> > • voodoo like the above makes me dislike python. To me, the one
> > advantage of python is its clarity enforced by its syntax.
> > Specifically, the forced indendation and quite simple semantics.
> > However, the way i've seen Guido's propensities and how python 3 is
> > moving to, it is becoming more mumbo jumbo of computer sciency OOP
> > jargons with syntax soup. (with iterators, enumerators, list
> > comprehension... shits forced upon the users)
> > The above line illustrate well the ad hoc syntax soup nature python is
> > moving into.
> To a native English speaker, it illustrates entirely the reverse.
> List comprehension is actually quite a linguistically natural way
> to express the iterative construction of a list.
computer lang is not human lang. In argument based on human lang, you
have AppleScript, Perl, which are un-readable or cumbersome to most
programers. Even with human lang, if you know linguistics to some
extend, you know that natural lang is a complete wortheless mess in
every aspect with respect to “design” qualities.
More information about the Python-list