Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [OT]Python/zsh/perl [was: named directory expansion on strings]

--- Vincent Stemen <zsh@xxxxxxxxxxx> wrote:
[quoted text "juggled around" a bit] 

> I agree.  This surprising discovery is the primary reason I never put
> any serious consideration into learning Python.

> I use the auto indentation features of xemacs all the time.  I see no
> way you could do that without code block delimiters.  Seems like a step
> backward in time.

Emacs seems to be the most popular editor for Python programmers.  It
knows when to start a new indent level, because the if, while, class,
etc. lines all end with a colon.  It can't tell when you want to close
block, of course, but if you're typing new code, that's a simple matter
hitting the backspace key once for every block you want to close out.  I
wouldn't /think/ of coding in Python if I didn't have Emacs or something
equally smart.

> Seems like it would be a nightmare to fix if you get your indentation
> messed up (which is extremely common when juggling code around).

Not sure exactly what you mean by "juggling around"; if you mean cutting
section from a file and moving it elsewhere in the file, or to a
file, at a point that starts out at a different indent level, there's a
key sequence to add or subtract an indent level from that entire block of
code, so that the pasted code will be consisent with itself as well as
fitting all under the appropriate if statement or whatever.  If you're
talking about code from someone else, esp. via email and things like
then there are more variables, of course.

Do I think blocking by indentation is the greatest thing since sliced
bread?  No.  But I've been surprised to find that it has rarely, if ever,
been a problem for me the way, oh, buffer overflows, objects that appear
to the lame compiler like they might not be instantiated even though they
definitely always are, or not knowing Perl have been.

> I was very pleased to find that you can do direct array indexing of
> single dimensional arrays in zsh.  ie. if x=abcd, then $x[2] = b.
> That very feature is most commonly the weakness of tradition shell
> script and even Perl that sometimes ends up causing me to write a
> routine as an external C program when I am writing a complex script.
> This is about the only complaint I can think of I have ever really had
> with Perl.

Funny, Python does this just fine :-)
 >>> a="spam"
 >>> a[3]

Bob Schmertz

Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam

Messages sorted by: Reverse Date, Date, Thread, Author