Internal Variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Colannino

    #1

    Internal Variables

    Hey everyone. I hope I have my terminology right, because I'm not quite
    sure what to call them. I was just wondering how I can find information
    in internal variables (for example - and I'm just making this up -
    __version__ to give me the version of Python.) The only reason I ask is
    that I'm trying very hard to search for information and can't find
    anything. Perhaps the information I'm looking for isn't even contained
    in variables but rather some other sort of object. Basically, I just
    want to know how from within a script I can get information about the
    python interpreter that I'm running. Thanks in advance.

    James

    --
    My blog: http://www.crazydrclaw.com/
    My homepage: http://james.colannino.org/

    "A well regulated militia being necessary to the security of a free
    state, THE RIGHT of the people to keep and bear arms SHALL NOT BE
    INFRINGED." --United States Constitution, Second Ammendment

  • Larry Bates

    #2
    Re: Internal Variables

    What you want are attributes of sys object.

    import sys
    print sys.version

    -Larry Bates

    James Colannino wrote:[color=blue]
    > Hey everyone. I hope I have my terminology right, because I'm not quite
    > sure what to call them. I was just wondering how I can find information
    > in internal variables (for example - and I'm just making this up -
    > __version__ to give me the version of Python.) The only reason I ask is
    > that I'm trying very hard to search for information and can't find
    > anything. Perhaps the information I'm looking for isn't even contained
    > in variables but rather some other sort of object. Basically, I just
    > want to know how from within a script I can get information about the
    > python interpreter that I'm running. Thanks in advance.
    >
    > James
    >[/color]

    Comment

    • Larry Bates

      #3
      Re: Internal Variables

      What you want are attributes of sys object.

      import sys
      print sys.version

      -Larry Bates

      James Colannino wrote:[color=blue]
      > Hey everyone. I hope I have my terminology right, because I'm not quite
      > sure what to call them. I was just wondering how I can find information
      > in internal variables (for example - and I'm just making this up -
      > __version__ to give me the version of Python.) The only reason I ask is
      > that I'm trying very hard to search for information and can't find
      > anything. Perhaps the information I'm looking for isn't even contained
      > in variables but rather some other sort of object. Basically, I just
      > want to know how from within a script I can get information about the
      > python interpreter that I'm running. Thanks in advance.
      >
      > James
      >[/color]

      Comment

      • Daniel Evers

        #4
        Re: Internal Variables

        Hi!

        The sys module provides some useful information, e.g.:

        builtin_module_ names -- tuple of module names built into this interpreter
        version -- the version of this interpreter as a string
        version_info -- version information as a tuple
        hexversion -- version information encoded as a single integer
        copyright -- copyright notice pertaining to this interpreter
        platform -- platform identifier
        executable -- pathname of this Python interpreter
        prefix -- prefix used to find the Python library
        exec_prefix -- prefix used to find the machine-specific Python library

        (from sys.__doc__)
        Maybe you can start searching there.

        Daniel

        Comment

        • Steven D'Aprano

          #5
          Re: Internal Variables

          On Fri, 11 Nov 2005 10:38:14 -0800, James Colannino wrote:
          [color=blue]
          > Hey everyone. I hope I have my terminology right, because I'm not quite
          > sure what to call them. I was just wondering how I can find information
          > in internal variables (for example - and I'm just making this up -
          > __version__ to give me the version of Python.) The only reason I ask is
          > that I'm trying very hard to search for information and can't find
          > anything.[/color]

          I find that there are many sources of information, such as books,
          libraries, and television documentaries. Perhaps if you tell us what sort
          of information you are after, we can suggest where you should be looking,
          rather than just assume it is hidden in "internal variables".

          BTW, since Python is open source software, you can download and read
          through the entire code base if you wish.



          --
          Steven.

          Comment

          • Paul Rubin

            #6
            Re: Internal Variables

            James Colannino <james@colannin o.org> writes:[color=blue]
            > Basically, I just want to know how from within a script I can get
            > information about the python interpreter that I'm running. Thanks in
            > advance.[/color]

            import sys
            print sys.version

            Comment

            Working...