Python Forum
Are braces rather than indentation ever wanted?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Are braces rather than indentation ever wanted?
#11
(Apr-30-2017, 05:15 PM)michaelcollier Wrote: ---
I use both methods myself, braces in my own editor, indentation in IDLE.
---
Hitting the keyboard with {}; is instinctive to me, whereas indentation causes me to slow down a bit.

Maybe it's time to start using proper/good IDE, that offers such functionality as auto-indentation and many more (auto-completion, etc.)? It depends on what OS, but there is long list of good IDEs to choose from. Generally IDLE is not considered good choice
Reply
#12
Code review was mentioned once here, but I'd also like to mention debugging and pair programming - you might say that your boss would never find out, and you might be right for a while, but at some point you're going to have to share code. You'll have to read someone else's code (review or pair programming or whatever) and vice versa, someone will have to read your code, probably at some point with you being there.

Don't try to force Python to be like other things you're comfortable with. When you learn a programming language, aim to learn its idioms. It might feel easier at first, but it's a serious handicap in the long run. Everyone else does the hard thing upfront and works well with each other later, if you do this you'll pay for it constantly.
Reply
#13
I longed for braces when I first started python in earnest.
Now I , don't even think about it, and would hate it if they were there.
I was a die hard C, C++ developer
Reply
#14
Anyone volunteering to fill Ig Nobel prize nomination for  Python with braces site candidacy
Wink ?
Sounds like The Brain's plan to take over the world - for those who are young enough  - or old enough  Smile  to remember The Pinky and The Brain

(Apr-30-2017, 06:49 PM)Larz60+ Wrote: I longed for braces behind when I first started python in earnest.
Now I , don't even think about it, and would hate it if they were there.
I was a die hard C, C++ developer

I think it was April's fool joke  Cool
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#15
My main focus is on developing in C/C+ for atmel tiny/mega microcontrollers, so I use C/C++ as my main language.

I'm providing learning tools for microcontroller beginners, this is so they can program in C/C++ but I give them the option of coding in a simpler C/C+ syntax with built in flowchart functionality and auto indentation / code folding.

The underlying GUI uses gold parser builder to import users source code, I added python a few weeks ago just for fun and to confirm to myself that the application can be multi-language.

Here is a link to some videos to show what it does, it is not a permanent URL:
http://www.raspberryflowchart.uk/

I do use other IDE's for myself, I just didn't list them all.. thanks....
Reply
#16
All this discussion reminds me of a draft for corporate C coding standards that someone submitted to me in the early 80s (because I was one of the few in the company to know C). It contained gems such as:
  • don't use switch/case statements
  • start your code with #define BEGIN { and #define END } and shun the use of the Braces From Hell.
and some others that made it obvious that the author was a Pascal minion. I wish I had kept a copy,  it would go straight in the same folder as the management memo that forbade the use of e-mail.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#17
Quote: reminds me of a draft for corporate C coding standards that someone submitted to me in the early 80s
Did it also include 'Don't use inheritance'?
Reply
#18
(May-01-2017, 04:07 PM)Larz60+ Wrote:
Quote: reminds me of a draft for corporate C coding standards that someone submitted to me in the early 80s
Did it also include 'Don't use inheritance'?

Object programming wasn't invented yet (or not mainstream enough). But come to think of it, the C++ coding standard form that same person could have been a fun read.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#19
(May-01-2017, 04:07 PM)Larz60+ Wrote: Did it also include 'Don't use inheritance'?
Are you driving DeLorean Wink ?!
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#20
I wish!, although I'm sure I would have sold it by now
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to output set items without the curly braces ? jimthecanadian 3 2,960 May-11-2019, 07:02 AM
Last Post: perfringo
  search and replace dots inside curly braces kchinnam 1 2,677 May-01-2018, 06:53 PM
Last Post: Larz60+
  No curly braces in python? RedSkeleton007 9 9,265 Jul-28-2017, 11:01 AM
Last Post: tony1812
  JSON API / no braces marucho21 1 3,928 Feb-01-2017, 07:35 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020