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.


    The time documentation

    Pythonista
    3
    7
    1571
    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.
    • Python567
      Python567 last edited by

      I found this list with all modules: http://omz-software.com/pythonista/docs/ios/index.html But I don‘t find the time module. Is that module on an other site, or where can I find all funktion?

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

        @Python567 Pythonista local doc

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

          @cvp ok, thanks. But than why do this code don‘t work?

          import datetime
          
          
          class t1 ():
          	def __init__ (self):
          		print(datetime.datetime)
          		
          		
          t1()
          

          I only found datetime at first so that here is now datetime.

          That what I don‘t understand is that here:
          class datetime.date
          Why is here in the documentation the word class before the datetime.date?

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

            datetime is a module
            datetime.datetime is a class
            datetime.datetime.now() is a method

            % python3

            >>> import datetime
            >>> print(datetime)
            <module 'datetime' from '/opt/homebrew/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/datetime.py'>
            >>> print(datetime.datetime)
            <class 'datetime.datetime'>
            >>> print(datetime.datetime.now())
            2021-02-11 10:23:51.443904
            
            
            # A more direct way to get to the useful stuff...
            >>> from datetime import datetime
            >>> print(datetime)
            <class 'datetime.datetime'>
            >>> print(datetime.now())
            2021-02-11 10:24:44.578089
            
            1 Reply Last reply Reply Quote 1
            • Python567
              Python567 last edited by Python567

              @ccc ok, but than there is no different in the performance?

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

                There might be a minor performance improvement if you avoid the dots...

                • https://docs.python.org/3/library/timeit.html
                • https://stackoverflow.com/questions/8220801/how-to-use-timeit-module
                1 Reply Last reply Reply Quote 0
                • Python567
                  Python567 last edited by

                  @ccc ok, thanks

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors