Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
Jason Novinger ( jnovinger@programming.dev ) M to Python@programming.dev · 3 years ago

donno2048/pygoto: Use goto in Python

github.com

external-link
message-square
4
link
fedilink
  • cross-posted to:
  • programming_horror@programming.dev
10
external-link

donno2048/pygoto: Use goto in Python

github.com

Jason Novinger ( jnovinger@programming.dev ) M to Python@programming.dev · 3 years ago
message-square
4
link
fedilink
  • cross-posted to:
  • programming_horror@programming.dev
GitHub - donno2048/pygoto: Use goto in Python
github.com
external-link
Use goto in Python. Contribute to donno2048/pygoto development by creating an account on GitHub.

At least I posted it to !programming_horror@programming.dev first!

alert-triangle
You must log in or # to comment.
  • xurxia ( xurxia@mander.xyz ) 
    link
    fedilink
    arrow-up
    8
    ·
    3 years ago

    Hi,

    I have used goto instruction a lot when I started to program in Basic ( an Amstrad CPC 🥹). In this context goto had logic. But in modern languages like python I think it is a very bad idea:

    • Understand the logic is more complex
    • Functions and methods are a better and more powerfull alternative
    • It is dangerous: add or remove a new line of code could have bad consequences

    Regards

    • stOneskull ( stOneskull@programming.dev ) 
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      3 years ago

      i’ve found a good alternative is returning functions

      eg. you have a function like this:

      def cycle(func): while True: func=func()

      then you start with cycle(main)

      def main(): return intro

      if __name__ == '__main__: cycle(main)

      and then main returns the next function, and following functions return functions…

      def intro(): if thisthing: return thisfunc if thatthing: return thatfunc

      return is being used like goto

      • Shayan Salehe ( shayan16sa@techhub.social ) 
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        @stOneskull @xurxia man it’s really cool

        • stOneskull ( stOneskull@programming.dev ) 
          link
          fedilink
          arrow-up
          2
          ·
          3 years ago

          you can see how i use it here: godschat

          read from the bottom up

  • Yearly1845 ( Yearly1845@reddthat.com ) 
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    2 years ago

    deleted by creator

  • RangerHere ( RangerHere@programming.dev ) 
    link
    fedilink
    arrow-up
    1
    ·
    3 years ago

    deleted by creator

Python@programming.dev

python@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !python@programming.dev

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events
Past

November 2023

  • PyCon Ireland 2023, 11-12th
  • PyData Tel Aviv 2023 14th

October 2023

  • PyConES Canarias 2023, 6-8th
  • DjangoCon US 2023, 16-20th (!django 💬)

July 2023

  • PyDelhi Meetup, 2nd
  • PyCon Israel, 4-5th
  • DFW Pythoneers, 6th
  • Django Girls Abraka, 6-7th
  • SciPy 2023 10-16th, Austin
  • IndyPy, 11th
  • Leipzig Python User Group, 11th
  • Austin Python, 12th
  • EuroPython 2023, 17-23rd
  • Austin Python: Evening of Coding, 18th
  • PyHEP.dev 2023 - “Python in HEP” Developer’s Workshop, 25th

August 2023

  • PyLadies Dublin, 15th
  • EuroSciPy 2023, 14-18th

September 2023

  • PyData Amsterdam, 14-16th
  • PyCon UK, 22nd - 25th
🐍 Python project:
  • Python
  • Documentation
  • News & Blog
  • Python Planet blog aggregator
💓 Python Community:
  • #python IRC for general questions
  • #python-dev IRC for CPython developers
  • PySlackers Slack channel
  • Python Discord server
  • Python Weekly newsletters
  • Mailing lists
  • Forum
✨ Python Ecosystem:
  • pyvideo
  • Awesome Python
  • PyCon US 2023 and videos!
🌌 Fediverse
Communities
  • #python on Mastodon
  • c/django on programming.dev
  • c/pythorhead on lemmy.dbzer0.com
Projects
  • Pythörhead: a Python library for interacting with Lemmy
  • Plemmy: a Python package for accessing the Lemmy API
  • pylemmy pylemmy enables simple access to Lemmy’s API with Python
  • mastodon.py, a Python wrapper for the Mastodon API
Feeds
  • Active c/Python posts
  • New c/Python posts
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 92 users / week
  • 172 users / month
  • 336 users / 6 months
  • 104 local subscribers
  • 8.08K subscribers
  • 652 Posts
  • 1.98K Comments
  • Modlog
  • mods:
  • Erlingur ( erlingur@programming.dev ) 
  • Jason Novinger ( jnovinger@programming.dev ) 
  • Luis Norambuena ( norambna@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code