Re: code indentation (python and c...)

  • From: james.homme@xxxxxxxxxxxx
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 3 Apr 2008 11:43:12 -0400

Hi,
Two does not make Python complain. If you are going to let sighted people
read your code, you might want to change it to four right before that.

Jim

James D Homme, , Usability Engineering, Highmark Inc.,
james.homme@xxxxxxxxxxxx, 412-544-1810

"it is only possible to live happily ever after on a day-to-day basis." --
Margaret Bonnano

Highmark internal only: Consider Usability Engineering On Your Next Project
or release. http://highwire.highmark.com/sites/iwov/hwt093/


                                                                           
             "Daniel Dalton"                                               
             <d.dalton@xxxxxxx                                             
             et.au>                                                     To 
             Sent by:                  "blind programming"                 
             programmingblind-         <programmingblind@xxxxxxxxxxxxx>    
             bounce@freelists.                                          cc 
             org                                                           
                                                                   Subject 
                                       code indentation (python and c...)  
             04/03/2008 08:26                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
             programmingblind@                                             
               freelists.org                                               
                                                                           
                                                                           




Hi,

I'm learning python and know a bit of c.
Is the following code ok?
Like is it fine to use 2 spaces for indenting instead of four?
I prefer 2 personally since I read braille...
So is this just a personal choice?

BTW how do you guys code in python with out braille?
Its quite white-space dependent...

Anyway is this code ok re white space?

#!/usr/bin/python
# my-program.py

i = 2
if i == 2 :
   print "hello"
print "done."

Obviously it is useless and the if is pointless since 2 is hard coded to
i...
But is the indentation fine?
Or is it a bad standard.
I know it works.

And is the following good c code re indentation?
Or should I be using 4 or 5 spaces?

int main (void)
{
   printf ("hello world\n");
}

So is my 2 space indenting ok? Or is this a personal choice thing?
Or is there a certain number of spaces I should follow?
I just set up my text editor (emacs) to do indenting for me and set it to
2...
Should this be changed?

Thanks,

--
Daniel Dalton

http://members.iinet.net.au/~ddalton/
d.dalton@xxxxxxxxxxxx
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: