New to Python - block grouping (spaces)yhoni

alister alister.nospam.ware at ntlworld.com
Thu Apr 16 20:03:17 CEST 2015


On Thu, 16 Apr 2015 14:44:15 +0100, BartC wrote:

> On 16/04/2015 14:18, alister wrote:
>> On Thu, 16 Apr 2015 13:07:22 +0200, Antoon Pardon wrote:
> 
>>> Nobody is argueing for arbitrary indentation.
>>
>> May I suggest that you give it a try for a month, perhaps re-writing a
>> small program you already have in a pythonic style (don't simply write
>> c in python) & see if your opinion changes.
> 
> You mean try writing pure Python for a month? Yes, you can get used to
> anything. But that doesn't take away from the issues that some people
> have with its indentation. In my case, that would be the following
> (apart from the extra fragility of the code which you can't argue with):

code fragility? google "goto fail", this could not have happened with 
python.
he try it suggestion was not to get you get used to it but to give you 
enough experience to show that your perceived problems are actually no 
existent FUD

> 
> * I need some closure, some indication of where the end of a block is.
> Otherwise how do I know I'm looking at the last statement, or whether
> there is more on the next page or further down the screen?

oh please if you are not going to look at the code you cant tell in a 
brace delimited language either & if you do open your eyes to scan the 
code it is easier to see in python because the indentation is 100% 
trustworthy where as with C you have to be careful that a brace has not 
been inserted somewhere unexpected.
> 
> Even when I can see what follows the block, I can only infer that this
> is the end of the block because I eventually hit some other arbitrary
> construct with less indentation, not something specifically signalling
> the end of /that/ block.

it is not arbitrary the un-indent is the signal 
> 
> (This would come up when using copy&paste for example. If I've
> accidentally left out the last line of a block, I won't know about it
> until the code later doesn't work.)


> * I modify code a lot, adding and removing extra nested blocks all the
> time. My editor can't indent or un-indent blocks without a lot of manual
> typing.

get a decent editor designed fro programming

> With block-delimited schemes, this isn't an issue, as temporary
> lack of correct indentation isn't crucial.
> 
> (However, given a choice of only brace-delimited blocks, and Python
> style, I'd go for the latter! I have a longer list of complaints for
> C-style braces.)


so you are already 90% of the way there & just need to grasp the fact 
that the braces are redundant if you (sensibly) stick to a rigid 
formatting style


-- 
Kiss your keyboard goodbye!



More information about the Python-list mailing list