Little novice program written in Python

castironpi at gmail.com castironpi at gmail.com
Fri Apr 25 00:43:42 EDT 2008


On Apr 24, 11:09 pm, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Thu, 24 Apr 2008 21:31:15 -0300, Rogério Brito <rbr... at ime.usp.br>
> declaimed the following in comp.lang.python:
>
> > a = [i for i in range(0,n+1)]
>
>         Uhm... At least in 2.4 and earlier, range() returns a list... No
> need for the list-comp in that era... range() also begins with 0
>
>
>
> >>> n = 5
> >>> a = range(n+1)
> >>> a
> [0, 1, 2, 3, 4, 5]
>
>         So just
>
>         a = range(n+1)
>
> could be used. Of course, if using a version where range() and xrange()
> have been unified...
>
> >>> c = list(xrange(n+1))
> >>> c
> [0, 1, 2, 3, 4, 5]
>
> --
>         Wulfraed        Dennis Lee Bieber               KD6MOG
>         wlfr... at ix.netcom.com              wulfr... at bestiaria.com
>                 HTTP://wlfraed.home.netcom.com/
>         (Bestiaria Support Staff:               web-a... at bestiaria.com)
>                 HTTP://www.bestiaria.com/

You're talking hardware-native, which machines don't guarantee.
Python can in another dimension of machine compatibility.  Stacks are
hardware native, the location of an array is not.  Python can retrieve
your stack in higher dimensions.

Fortunately, Python's community is sturdy against counterproductivity
en masse, so it's okay to hairbrain it.  Cover features of
improvements, though, and you might get a Bayes Net change to make and
courses to steer.  The community values the flexibility of machine-
independency too.

However, real numbers are not integers, so opinion mass of integer
algorithms may favor C.  But you just need micro-sales (and scales!)
to examine the future of Python.  Welcome to our group.



More information about the Python-list mailing list