About 51 results
Open links in new tab
  1. What are blocks of code in Python? The definitions are all confusing ...

    Jan 13, 2021 · A block is the structure of code to separate part of the code from another part of the code. A function is a block, and classes are blocks and self consist of many blocks inside.

  2. How to organize Python code into collapsable / expandable chunks?

    Jul 11, 2019 · if True: # block code goes here A fancier way is to use a descriptive string in the condition. The description stays visible for a collapsed block. You can also disable these with negation anytime, …

  3. Is there a shortcut to comment multiple lines in python using VS Code ...

    Sep 26, 2022 · Instead of indivually typing out a hash tag in front of each line, is there a way to select a block of code and comment/uncomment everything by only pressing a couple shortcut keys?

  4. The notion of block in Python - Stack Overflow

    Nov 15, 2022 · A Python program is constructed from code blocks. A block is a piece of Python program text that is executed as a unit. The following are blocks: a module, a function body, and a class …

  5. How to comment out a block of code in Python [duplicate]

    Is there a mechanism to comment out large blocks of Python code? Right now, the only ways I can see of commenting out code are to either start every line with a #, or to enclose the code in triple quotes: """.

  6. Jupyter notebook markdown and fenced code blocks

    Feb 20, 2022 · So how do I get the exact same output with IPython.display.Markdown, as I get from just having Markdown text in a Jupyter notebook markdown cell - with a vertical space between …

  7. Use Code::Blocks for Python programming

    Aug 11, 2012 · Alternatively use the FileManager plugin and Tools+ plugin to view your script directory and configure launchers for your favorite python (or any other) tools. Arguably this is more pythonic.

  8. python - How can I suppress ruff linting on a block of code - Stack ...

    Jan 26, 2024 · I would like to disable/suppress the ruff linter (or certain linting rules) on a block of code. I know that I can do this for single lines (by using # noqa: <rule_code> at the end of the line) or for …

  9. How can I time a code segment for testing performance with Pythons ...

    Rather than select a clock by hand, use timeit.default_timer; Python has already done the work for you. But really, you should use timeit.timeit(myfast, number=n) instead of re-inventing the repetitive call …

  10. python - How to block calls to print? - Stack Overflow

    Dec 10, 2018 · I created a pygame.joystick.Joystick object and in the actual loop of the game call its member function get_button to check for user input. The function also calls print, which slows down …