POV-Ray : Newsgroups : povray.off-topic : All bow to the mighty Python Server Time
4 Sep 2024 19:19:00 EDT (-0400)
  All bow to the mighty Python (Message 35 to 44 of 84)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Invisible
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 11:53:09
Message: <4bcf1f65$1@news.povray.org>
>> (Again, I can't comment on Python, but in Haskell you *can* in fact 
>> still put multiple statements on a line, or spread one statement over 
>> several lines. It's really not stopping you from doing that.)
> 
> Python too. I don't think you could put the whole program on one line, 
> because I don't think you can dedent except at the end of a line.

Haskell really will allow you to put the entire program on line (really 
long) line.

But then, in Haskell, whitespace is *optional*. You can use semicolons 
and curly braces instead if you prefer. It's just that nobody ever does 
(except for sticking several items on one line).

>> I have never seen any text editor ever that converts spaces to tabs - 
> 
> You can ask for it in most editors.

Really? Why on earth would you want to? Tabs are evil and should never 
have existed in the first place! o_O

>> Becuase no editor in existence can syntax hilight Haskell?
> 
> What's the extention for Haskell source files?

Plain source is *.hs, "literate Haskell" is *.lhs (That's where all text 
is comments be default, and source is quoted, rather than the usual way 
around.)

> Can you post a snippit of Haskell here?

What, the other groups don't have enough Haskell source in them already?

   qsort xs =
     case xs of
       []   -> []
       [x]  -> [x]
       x:xs ->
         let
           ys1 = filter (x <) xs
           ys2 = filter (x >) xs
         in qsort ys1 ++ [x] ++ qsort ys2

>> (Besides, Emacs isn't a text editor, it's an operating system! :-P )
> 
> Out of curiousity, does elisp run outside of emacs? Can emacs run 
> without a window open?  I.e., could you write a web server in elisp?

No idea mate, no idea. :-)

>> That does actually sound quite nice. I've never seen an editor which 
>> can actually do that.
> 
> Uh, visual studio?

As documented, VS doesn't indent things the way *I* like. ;-)


Post a reply to this message

From: Invisible
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 11:53:51
Message: <4bcf1f8f$1@news.povray.org>
Darren New wrote:

> Plus, as you're typing the arguments, it gives you help for each argument.
> 
> I.e., so you know whether it's radians or degrees expected.

Or find out what the hell the order of the argument is...


Post a reply to this message

From: Darren New
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 11:57:07
Message: <4bcf2053$1@news.povray.org>
Warp wrote:
> Darren New <dne### [at] sanrrcom> wrote:
>> Warp wrote:
>>>   Also autoindentation of Python code is a physical impossibility.
> 
>> No it's not.
> 
>   Clearly your definition of "autoindentation" is not the same as mine.

I guess not. I figured you meant "indenting as you type" or something. Not 
"strip all indicators of block structure, followed by trying to replace 
them."  The editors one uses for python all indent when you start a block 
automatically and keep that indent until you type the dedent character.

>   No, it's not. Why not? Because whitespaces at the beginning of lines are
> a lot easier to lose than braces.

Only if the software you're using strips them out on purpose.

What you're saying is "Python using whitespace is stupid because a lot of 
web sites don't treat whitespace as significant."  Sure, OK, that's an opinion.

-- 
Darren New, San Diego CA, USA (PST)
   Linux: Now bringing the quality and usability of
   open source desktop apps to your personal electronics.


Post a reply to this message

From: Darren New
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 11:57:12
Message: <4bcf2058$1@news.povray.org>
Warp wrote:
>   There are many situations where you need to re-indent code, either deeper
> or shallower (and not always every line the same amount). 

Your cut and paste has to be smart about reindenting the code, yes. But 
that's no harder than indenting code based on { } markers.

-- 
Darren New, San Diego CA, USA (PST)
   Linux: Now bringing the quality and usability of
   open source desktop apps to your personal electronics.


Post a reply to this message

From: Warp
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 12:07:26
Message: <4bcf22be@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> >   Indenting is easier when the editor does it for you.

> You should try an IDE that indents Python for you. It's really actually 
> fewer keystrokes than C-like languages, because the start-of-indent is part 
> of the syntax. There's an indent key and a dedent key

  In emacs there's one single key for indenting, which will indent new lines
or existing lines, regardless of where in the line the cursor is at the
moment and whether the line is currently over-indented or under-indented.

  How is that "fewer keystrokes".

> and you use them *instead* of { and }.

  { and } have nothing to do with indentation. They aren't even necessary
for all code blocks.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 12:09:57
Message: <4bcf2354@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> > Darren New <dne### [at] sanrrcom> wrote:
> >> Warp wrote:
> >>>   Also autoindentation of Python code is a physical impossibility.
> > 
> >> No it's not.
> > 
> >   Clearly your definition of "autoindentation" is not the same as mine.

> I guess not. I figured you meant "indenting as you type" or something.

  That's only *part* of it. Autoindentation works on existing lines too.

> What you're saying is "Python using whitespace is stupid because a lot of 
> web sites don't treat whitespace as significant."  Sure, OK, that's an opinion.

  I think it's a very valid opinion taking into account the amount of
programming forums and blogs out there.

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 12:10:26
Message: <4bcf2372$1@news.povray.org>
Invisible wrote:
> Darren New wrote:
> 
>> Plus, as you're typing the arguments, it gives you help for each 
>> argument.
>>
>> I.e., so you know whether it's radians or degrees expected.
> 
> Or find out what the hell the order of the argument is...

Yep. Even better than type signatures, when you have three floats in a row.

Or it makes it easy to figure out you can do something like
   Color newcolor = new Color(oldcolor, newalpha)
and see that there's an overload for constructing a color out of the RGB of 
one color and a specific alpha value.

(And no, the "new" is syntactic noise there - it doesn't allocate anything 
on the heap.)

-- 
Darren New, San Diego CA, USA (PST)
   Linux: Now bringing the quality and usability of
   open source desktop apps to your personal electronics.


Post a reply to this message

From: Darren New
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 12:12:42
Message: <4bcf23fa$1@news.povray.org>
Warp wrote:
>   How is that "fewer keystrokes".

That's "reindenting". I'm talking about indenting as you type. That kind of 
indenting isn't useful in Python, any more than a macro to "add in the 
missing braces" is useful.

>> and you use them *instead* of { and }.
> 
>   { and } have nothing to do with indentation. They aren't even necessary
> for all code blocks.

And indenting isn't necessary for all code blocks in Python. But, like { } 
in C, indenting is necessary when you have several statements on separate 
lines that you want as a block.

I'm saying that indenting isn't a tedious matter of typing the right number 
of tabs on each line in Python.

-- 
Darren New, San Diego CA, USA (PST)
   Linux: Now bringing the quality and usability of
   open source desktop apps to your personal electronics.


Post a reply to this message

From: Darren New
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 12:13:58
Message: <4bcf2446@news.povray.org>
Invisible wrote:
> As documented, VS doesn't indent things the way *I* like. ;-)

Did you ever adjust it to your liking? There's a bunch of knobs to tweak, 
you know.

-- 
Darren New, San Diego CA, USA (PST)
   Linux: Now bringing the quality and usability of
   open source desktop apps to your personal electronics.


Post a reply to this message

From: Darren New
Subject: Re: All bow to the mighty Python
Date: 21 Apr 2010 12:36:52
Message: <4bcf29a4$1@news.povray.org>
Warp wrote:
>> I guess not. I figured you meant "indenting as you type" or something.
>   That's only *part* of it. Autoindentation works on existing lines too.

If existing lines are indented incorrectly, then your code is broken. The 
reason that "auto indenting" is not possible in Python is the same reason 
that "auto bracing" isn't possible in C.

>> What you're saying is "Python using whitespace is stupid because a lot of 
>> web sites don't treat whitespace as significant."  Sure, OK, that's an opinion.
> 
>   I think it's a very valid opinion taking into account the amount of
> programming forums and blogs out there.

Sure. It's just a question of whether you're fixing the wrong problem. It's 
like saying everyone should learn English because most blogs only handle 
ASCII.  People fixed most of the web apps to not corrupt < and >.  People 
who post Python code should do it via web apps that don't corrupt leading 
whitespace in python apps.

Now, I'll grant that the best thing would be to have indent and dedent 
characters or sequences (like trigraphs in C perhaps).  Cutting text from a 
Python file should insert said trigraphs, and text editors that understand 
python could turn them back into appropriate indentation. (Using the generic 
"you":) But reducing *my* productivity during coding simply because *you* 
are too lazy to not corrupt my source code is not a good thing.

-- 
Darren New, San Diego CA, USA (PST)
   Linux: Now bringing the quality and usability of
   open source desktop apps to your personal electronics.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.