omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Syntax Error add_subview line 23

    Pythonista
    4
    15
    5704
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cvp
      cvp @sendog3c last edited by

      @sendog3c That's not what my wife says 😂

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        @cvp. You should convince your wife to do https://en.m.wikipedia.org/wiki/Pair_programming with you.

        cvp 1 Reply Last reply Reply Quote 0
        • sendog3c
          sendog3c last edited by

          Can make you a theory question ?

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @ccc last edited by

            @ccc My wife is an artist and she hates computers...

            1 Reply Last reply Reply Quote 0
            • cvp
              cvp @sendog3c last edited by

              @sendog3c ?

              1 Reply Last reply Reply Quote 0
              • sendog3c
                sendog3c last edited by

                jejeje nice jokes

                cvp 1 Reply Last reply Reply Quote 0
                • cvp
                  cvp @sendog3c last edited by cvp

                  @sendog3c My "?" was about your theory question

                  1 Reply Last reply Reply Quote 0
                  • sendog3c
                    sendog3c last edited by

                    My question are basically: how do I have to structure my code; by example: the entire code in only one *.py file or should I divide it in parts; and if it better in parts how to do that?

                    Thanks.

                    cvp mikael 2 Replies Last reply Reply Quote 0
                    • cvp
                      cvp @sendog3c last edited by cvp

                      @sendog3c I'll let big Python specialists, like @ccc and @mikael, answer but, personally, I create little .py for reusable functions or classes, and one script for each application.

                      1 Reply Last reply Reply Quote 0
                      • mikael
                        mikael @sendog3c last edited by

                        @sendog3c, see one big comprehensive answer here.

                        For my Pythonista coding and fun projects, I mostly stay in one file until:

                        • It is too long to keep scrolling up and down on the phone
                        • Or I need to develop in two locations at once, in which case it is more convenient to jump between two files = tabs
                        • I have alternative components that you pick from when importing, like different storage backends
                        • Or the project gets really big and splitting into logical files and folders is necessary just to find things
                        1 Reply Last reply Reply Quote 0
                        • sendog3c
                          sendog3c last edited by

                          Thank you CVP & Mikael. I am going to read the article prior to continue. But a last question for instances:

                          How do I call a .py from another .py when running your program?

                          cvp 1 Reply Last reply Reply Quote 0
                          • cvp
                            cvp @sendog3c last edited by

                            @sendog3c If you need to call some def's, easiest way = import, like you do for standard modules:

                            p1.py
                            =====
                            
                            def my1():
                            	........
                            	
                            p2.py
                            =====
                            import p1
                            
                            p1.my1()
                            
                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB Forums | Contributors