1. Python

Every now and then, I like to scope out the 'competition'. C and C++ hold no
charms for me; Java makes my grumpy, and Perl gives me a headache. But
Python is a different matter...

Yes, I know that using indentation instead of proper delimiters is only
inviting trouble, but darn it, there are so many *nice* things about the
language, like:

   >>> 'x' + word[1:]
   'xelpA'

which is akin to the oft-requested:

   "x" & word[2..]

although I personally prefer:

   "x" & word[2..len]

There are a number of other 'clever' things that are done using negative
indexes and such, but I'll skip them here. After all, I'm not trying to
write a Python tutorial. You can always go to:

   http://www.python.org

and check out the tutorials yourself. And I'll also gloss over the fact the
Python strings are immutable.

Now, I know that a that I could just to write a nice set of string handling
routines, since these are just clever implementations of BASIC's left$,
right$ and mid$ functions. Perhaps I might even grant that 'clever' makes
unreadable code a couple weeks down the line. I almost convince myself, but
then I read:

   "Degenerate slice indices are handled gracefully: an index
   that is too large is replaced by the string size, an upper
   bound smaller than the lower bound returns an empty string."

Euphoria's handling of degenerate slices has always been one of my pet
peeves. And Python also has some neat list handling operators, especially
the item removal notation:

   >>> # Replace some items:
   ... a[0:2] = [1, 12]
   >>> a
   [1, 12, 123, 1234]
   >>> # Remove some:
   ... a[0:2] = []
   >>> a
   [123, 1234]
   >>> # Insert some:
   ... a[1:1] = ['bletch', 'xyzzy']
   >>> a
   [123, 'bletch', 'xyzzy', 1234]
   >>> a[:0] = a     # Insert (a copy of) itself at the beginning
   >>> a
   [123, 'bletch', 'xyzzy', 1234, 123, 'bletch', 'xyzzy', 1234]

Python has namespaces, so writing:

   >>> import fibo

imports a module; routines in the module are accessed through the namespace:

   >>> fibo.fib(1000)

If you intend to use a function often you can assign it to a local name:

   >>> fib = fibo.fib
   >>> fib(500)

You can import a list of functions:

   >>> from fibo import fib, fib2

Or even all the routines:

   >>> from fibo import *
   >>> fib(500)

Routines that are local to the module are specified by using an underscore.
But Robert already knows all this (and Java, and C++), so I'm sure he'll
take it into account when designing his own namespace solution. smile

I won't even go into exception handling and classes. Did I mention that it's
linked to a zillion libraries, including wxWindows? But there are a lot of
things to like about the language. Python is just looking better and better!

Ok, this isn't intended to be a Python lovefest. What's not to like about
it?

For one thing, the sheer size of it. I wanted to play around with wxPython,
so I went to download it. First, I need the (several meg large) wxPython
installer. And Winsock 2.0 and OpenGL. But wait, there's more. I need the
core Python download as well (5 meg compressed) and possibly some additional
files. My mind reels when I think about having to distribute an application.

There's also the dangerous use of indentation to delimit blocks, the slow
speed... Even so, it still looks very, very cool. I wish *my* language were
that cool...

Yeah, yeah - the feature list is always greener on the other side. Still, I
wouldn't mind a bit if Robert decided to filch a few of them from Python for
us.

-- David Cuny

new topic     » topic index » view message » categorize

2. Re: Python

Have you looked at Ruby?  http://www.ruby-lang.org/en/
It is similar to Python, but doesn't have the indentation requirement.


----- Original Message -----
From: "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, August 25, 2000 8:51 PM
Subject: Python


> Every now and then, I like to scope out the 'competition'. C and C++ hold
no
> charms for me; Java makes my grumpy, and Perl gives me a headache. But
> Python is a different matter...
>

<snip>

> There's also the dangerous use of indentation to delimit blocks, the slow
> speed... Even so, it still looks very, very cool. I wish *my* language
were
> that cool...
>
> Yeah, yeah - the feature list is always greener on the other side. Still,
I
> wouldn't mind a bit if Robert decided to filch a few of them from Python
for
> us.
>
> -- David Cuny
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Python

After my Python rant, I plunked down my $25 Border's gift certificate for
O'Reilly's "Learning Python" for some nightime reading.  (Yes, I slept quite
soundly) The ugly truth comes out: in Python, a list is little more than an
array of pointers. If you write something like this:

   >>> x = [1,2,3]
   >>> y = [ 'a', 'b', x ]

you get the expected result that Euphoria would give you:

   >>> print y
   ['a', 'b', [1,2,3]]

But if you change the value of x:

   >>> x = 'c'

and you've altered y as well:

   >>> print y
   ['a', 'b', 'c']

This makes it easy for the compiler writers - all the work is shoved off on
the poor coders! This is the same nonsense that Java does - they hide the
pointer from you, but you still get the same nasty side-effects. I guess
I've really been spoiled by Euphoria.

Ah, well. I got the book to see how they implement namespaces, classes and
other goodies, not sequences. I'll be chiming in with my new wishlist, now
that Robert's got free time on his time.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

4. Python

Someone said that python could be used with a WDOSX.
Where did you see that ?

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu