[Tutor] Random Number Generator

bhaaluu bhaaluu at gmail.com
Wed Dec 5 13:35:59 CET 2007


$ python
>>> help()
help> 'topics'
[snip]
CODEOBJECTS         FRAMES              POWER               TUPLES
[snip]
help> 'POWER'
------------------------------------------------------------------------

  5.4 The power operator

  The power operator binds more tightly than unary operators on its left;
  it binds less tightly than unary operators on its right. The syntax is:

        power    ::=     primary[1] ["**" u_expr[2]]

  Download entire grammar as text.[3]
:

It seems to be case-sensitive Mr. Moores!
When I entered 'power' (like you did), I also got:
help> 'power'
no Python documentation found for 'power'

Try entering: 'POWER'  (all caps, just like in the output).

Happy Programming!
-- 
b h a a l u u at g m a i l dot c o m


On Dec 5, 2007 6:31 AM, Dick Moores <rdm at rcblue.com> wrote:
>
>  At 02:41 PM 12/4/2007, bhaaluu wrote:
>
> I'm running the Python 2.4.3 interactive interpreter
>  in a Konsole at a bash prompt:
>
>  $ python
>
>  >>> help
>  Type help() for interactive help, or help(object) for help about object.
>  But look what I get with Python 2.5.1 and Win XP:
>
>  =============================================================
>  >>> help('topics')
>
>  Here is a list of available topics.  Enter any topic name to get more help.
>
>  ASSERTION           DEBUGGING           LITERALS
> SEQUENCEMETHODS2
>  ASSIGNMENT          DELETION            LOOPING             SEQUENCES
>  ATTRIBUTEMETHODS    DICTIONARIES        MAPPINGMETHODS      SHIFTING
>  ATTRIBUTES          DICTIONARYLITERALS  MAPPINGS            SLICINGS
>  AUGMENTEDASSIGNMENT DYNAMICFEATURES     METHODS
> SPECIALATTRIBUTES
>  BACKQUOTES          ELLIPSIS            MODULES
> SPECIALIDENTIFIERS
>  BASICMETHODS        EXCEPTIONS          NAMESPACES          SPECIALMETHODS
>  BINARY              EXECUTION           NONE                STRINGMETHODS
>  BITWISE             EXPRESSIONS         NUMBERMETHODS       STRINGS
>  BOOLEAN             FILES               NUMBERS             SUBSCRIPTS
>  CALLABLEMETHODS     FLOAT               OBJECTS             TRACEBACKS
>  CALLS               FORMATTING          OPERATORS           TRUTHVALUE
>  CLASSES             FRAMEOBJECTS        PACKAGES            TUPLELITERALS
>  CODEOBJECTS         FRAMES              POWER               TUPLES
>  COERCIONS           FUNCTIONS           PRECEDENCE          TYPEOBJECTS
>  COMPARISON          IDENTIFIERS         PRINTING            TYPES
>  COMPLEX             IMPORTING           PRIVATENAMES        UNARY
>  CONDITIONAL         INTEGER             RETURNING           UNICODE
>  CONTEXTMANAGERS     LISTLITERALS        SCOPING
>  CONVERSIONS         LISTS               SEQUENCEMETHODS1
>
>  >>> help('power')
>  no Python documentation found for 'power'
>
>  >>> help('lists')
>  no Python documentation found for 'lists'
>
>  >>> help('classes')
>  no Python documentation found for 'classes'
>
>  >>> help('modules')
>
>  Please wait a moment while I gather a list of all available modules...
>
>
>  Traceback (most recent call last):
>    File "<pyshell#7>", line 1, in <module>
>      help('modules')
>    File "E:\Python25\lib\site.py", line 346, in __call__
>      return pydoc.help(*args, **kwds)
>    File "E:\Python25\lib\pydoc.py", line 1645, in __call__
>      self.help(request)
>    File "E:\Python25\lib\pydoc.py", line 1682, in help
>      elif request == 'modules': self.listmodules()
>    File "E:\Python25\lib\pydoc.py", line 1803, in listmodules
>      ModuleScanner().run(callback)
>    File "E:\Python25\lib\pydoc.py", line 1854, in run
>      for importer, modname, ispkg in pkgutil.walk_packages():
>    File "E:\Python25\lib\pkgutil.py", line 110, in walk_packages
>      __import__(name)
>    File
> "E:\Python25\lib\site-packages\dmath-0.9-py2.5.egg\dmath\__init__.py", line
> 343, in <module>
>  NameError: name 'context' is not defined
>  >>>
>  ============================================================
>  However, getting help for things like random, random.uniform, math, list,
> tuple, works fine.
>
>  For example,
>
>  ============================================
>  >>> help('random.uniform')
>  Help on method uniform in random:
>
>  random.uniform = uniform(self, a, b) method of random.Random instance
>      Get a random number in the range [a, b).
>  >>>
>  ==============================================
>
>  Dick Moores
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


More information about the Tutor mailing list