4
jkommeren
91d

Why the fuck isnt pythons tabbed loop thing something that's configurable?

So many things to like about python, but is there someone on this planet who actually likes this feature?

Trying to use it in Jupyter notebook (browser) is a nightmare, because tab will focus on next ui element.

Or am i missing something?

Comments
  • 4
    Its the fault of the editor, not the language. If you develop in python, why didnt you got into this problem earlier? Pythons Syntax uses tabs or spaces to define blocks.
  • 1
    @stop you have a point of course, that's why I ask, why is it not configurable? And who actually likes this feature so much they think it should remain mandatory, given it has never changed? Please explain why you think it's a good thing?

    Semicolons are optional. Why not the same for brackets? 🤔
  • 3
    @jkommeren its possible to use tabs or spaces. So you can use one space to indent a block. And this is the core feature of python.
    the only thing you need to remember is to use the same amount of spaces for each level in the whole file.
  • 1
    @stop Fair enough. But it would help if i could add them for clarity anyway, single spaces are easy to miss.
    I could work around it. But do you actually like that feature? Is it worth its mandatoriness?
  • 4
    @jkommeren the standard indentation is 4 spaces. And i think its better than to search where i missed a curly brace.
  • 1
    @stop hmyeah perhaps I'm too used to the editor fixing it for me once i start inserting brackets 🤔

    merci for 4 the spaces, good to know. I'll just keep to that then 🙂
  • 3
    I'm not sure what the intention of Python was.... Never looked it up.

    But many devs don't realize / don't want to realize that code has a flow.

    Proper formatting, no nested if/else stuff, ... makes it easy to follow the code flow.

    I think that Pythons way is hard to get at the beginning, but code formatting matters.

    And usually code formatting discussions end up with a room full of toddlers throwing stuff at each others "cause MIINEEE is best".

    Hence I'm thankful that Python implemented this.

    In PHP there are PSRs (recommendations) and while good devs just accept and follow them as a compromise, we had quite a lot of toddler discussions in teams... *rolls eyes*

    The "nice" way doesn't work most of the time, the enforced way will work and will cost less time, less stress and is easier.

    Thanks Python ;)
  • 1
    Yeah, there really could be less parentheses in Lisp...
  • 1
    @IntrusionCM i recommend reading PEP 8, which is a accepted codestyle for python.
  • 2
    What browser are you using? It is possible that the browser prevents jupyter from overriding tab navigation because somebody had a power trip and decided how everything that runs in a browser window should work.
  • 1
    @homo-lorens good point! I was using Edge. I'll give some others a try!
  • 0
    Python.

    Theres your first mistake.

    I like python. I use it. And even I think its a mistake. A beautiful one for certain.

    Also is jupyter notebook half as good as it sounds?
  • 0
    @stop I actually wouldnt mind a worse-of-both-worlds option.

    colon to open blocks, and semicolon to close blocks. These two pieces of punctuation replace curly braces and just seem to be happy middle ground. No more fucking with invisible formating. Semicolon used to end lines, now it closes scopes, which feels like a natural evolution, and colons open scopes, which to a python user also seems appropriate.

    And I've meant more than a few people that absolutely *hated* it, which tells me some are bound to enjoy the concept.
Add Comment