flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > On python's indentation

Author
Thread Post new topic Reply to topic
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
treeform wrote:
python indentation is fantastic grow up!
It is one of the worst aspects of Python, and a pretty silly idea as a language construct.

_________________
Image - carpe noctem
Post 01 Nov 2010, 08:10
View user's profile Send private message Visit poster's website Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 701
guignol
f0dder
Can you brag for me a little, why you dig Python?
Post 01 Nov 2010, 11:03
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Oh, the form/function debate.

Can I play a side? Very Happy
Post 02 Nov 2010, 04:56
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17284
Location: In your JS exploiting you and your system
revolution
Okay, I'll play.

The indentation thing imposes some quite serious restrictions on the editor software settings. If you like to use tabs and someone else likes to use spaces, and both of you edit the same sources, then that would seem to create a rather large potential for fucked up indentation as seen by Python but looks perfectly normal in the editor screen.

I see indentation as a stylistic thing that is a user preference. I can't see how imposing it in a language is an advantage.

[edit] Actually, this indentation thing is one of the reasons I wrote fasmarm. The normal ARM assembler imposed this also. All labels had to start at column one, and all instruction/macros had to start with at least one whitespace. I disliked the restriction so much that I needed to get away from it, hence fasmarm appeared. I felt it was just laziness on the part of the assembler writers. There was no need for it really.


Last edited by revolution on 02 Nov 2010, 06:47; edited 1 time in total
Post 02 Nov 2010, 05:23
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Python editors allow seeing normally non-displayed characters, and even FASMW has a feature to converting those characters -- problem solved. There is some stylistic restriction imposed, but it is minimal as the programmer only need use a consistent indentation and not a specific indentation.

I don't program in Python.
Post 02 Nov 2010, 06:15
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17284
Location: In your JS exploiting you and your system
revolution
Hehe, the problem is not solved if one has to use special/specific editors just to write Python stuff. I like my current editor and am very used to it. My coding performance would drop drastically if I had to switch editors and comply with stylistic restrictions.
Post 02 Nov 2010, 06:18
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
No doubt, there is a use case for your current tools which would not imped your productivity. Any adjustment in your coding style would be greatly offset by the added performance Python would impart. Python will leverage your existing skill-set. Very Happy
Post 02 Nov 2010, 06:42
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17284
Location: In your JS exploiting you and your system
revolution
Like the programming language Whitespace, if you get the spacing wrong you also get the program wrong. Invisible things should not affect the outcome. No chance to detect errors of omission, too many implicit things happening, too much to get distracted by when typing ("Oh, is it 3 spaces or 4?").


Last edited by revolution on 02 Nov 2010, 10:29; edited 1 time in total
Post 02 Nov 2010, 06:52
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
This initial confusion is common. The chance of error is completely eliminated through proper editor configuration, or the use of an intermediate translator in rare cases. The syntactic structure is exactly the opposite of implicit - the explicit form eases comprehension. With continued use of Python you'll see how it fits your needs perfectly.
Post 02 Nov 2010, 07:26
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
In the real world, tabs and spaces get mixed up - the Pythonistas response is "delete that editor!" or "fix the configuration", but that's not always possible if you live in the real world and have to work with other people.

Then there's the issue of formatting-mangling transfer mediums... some forum software, email clients, et cetera.

Yes, consistent indentation is a Very Good Thing, but I find that using it as a language device creates more confusion & bug opportunities than it fixes stuff. Using block delimiters (whether being/end or curly braces or WHATEVER) means you intent is 100% clear, and if the source got mangled along the way it can be reformatted without possibility of error. Heck, it means you can reformat code to your preferences, automatically.
Post 02 Nov 2010, 09:19
View user's profile Send private message Visit poster's website Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 701
guignol
Yeah! Choke the Python!
Post 07 Nov 2010, 08:06
View user's profile Send private message Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 701
guignol
bitRAKE
Leave your "pooper editor confiuration" to your elf(ves).

(Some, simply can't get over snake game)
Post 07 Nov 2010, 08:19
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 821
Location: Jakarta, Indonesia
TmX
If I'm not mistaken, the whitespace-sensitive is inherited from Haskell, one of the language Python influenced from.
Post 07 Nov 2010, 12:26
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Return of the snake...

http://nickgravgaard.com/elastictabstops/

...just another view point on related topic.
Post 08 Nov 2010, 16:14
View user's profile Send private message Visit poster's website Reply with quote
masonswanson



Joined: 17 Aug 2010
Posts: 51
masonswanson
bitRAKE wrote:
Return of the snake...

http://nickgravgaard.com/elastictabstops/

...just another view point on related topic.

that site tried to run something on my systemdrive's root
Post 30 Jan 2011, 18:23
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Could it have been your browser trying to run Java? There's a Java app on the page.
Post 30 Jan 2011, 19:38
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.