1. 03 Sep, 2001 2 commits
    • Tim Peters's avatar
      Make dir() wordier (see the new docstring). The new behavior is a mixed · 5d2b77cf
      Tim Peters authored
      bag.  It's clearly wrong for classic classes, at heart because a classic
      class doesn't have a __class__ attribute, and I'm unclear on whether
      that's feature or bug.  I'll repair this once I find out (in the
      meantime, dir() applied to classic classes won't find the base classes,
      while dir() applied to a classic-class instance *will* find the base
      classes but not *their* base classes).
      
      Please give the new dir() a try and see whether you love it or hate it.
      The new dir([]) behavior is something I could come to love.  Here's
      something to hate:
      
      >>> class C:
      ...     pass
      ...
      >>> c = C()
      >>> dir(c)
      ['__doc__', '__module__']
      >>>
      
      The idea that an instance has a __doc__ attribute is jarring (of course
      it's really c.__class__.__doc__ == C.__doc__; likewise for __module__).
      
      OTOH, the code already has too many special cases, and dir(x) doesn't
      have a compelling or clear purpose when x isn't a module.
      5d2b77cf
    • Tim Peters's avatar
  2. 02 Sep, 2001 16 commits
  3. 01 Sep, 2001 11 commits
  4. 31 Aug, 2001 6 commits
    • Guido van Rossum's avatar
      Add various and sundry news items -- most mine, one Barry's, one · ae45714e
      Guido van Rossum authored
      Michael Hudson's.
      ae45714e
    • Guido van Rossum's avatar
      Oops. The -W option takes args, not -X. · 97741a30
      Guido van Rossum authored
      97741a30
    • Guido van Rossum's avatar
      Allow for the possibility that globals['__name__'] does not exist; · 8031bbec
      Guido van Rossum authored
      substitute "<string>" for the module name in that case.  This actually
      occurred when running test_descr.py with -Dwarn.
      8031bbec
    • Guido van Rossum's avatar
      Add warning mode for classic division, almost exactly as specified in · 393661d1
      Guido van Rossum authored
      PEP 238.  Changes:
      
      - add a new flag variable Py_DivisionWarningFlag, declared in
        pydebug.h, defined in object.c, set in main.c, and used in
        {int,long,float,complex}object.c.  When this flag is set, the
        classic division operator issues a DeprecationWarning message.
      
      - add a new API PyRun_SimpleStringFlags() to match
        PyRun_SimpleString().  The main() function calls this so that
        commands run with -c can also benefit from -Dnew.
      
      - While I was at it, I changed the usage message in main() somewhat:
        alphabetized the options, split it in *four* parts to fit in under
        512 bytes (not that I still believe this is necessary -- doc strings
        elsewhere are much longer), and perhaps most visibly, don't display
        the full list of options on each command line error.  Instead, the
        full list is only displayed when -h is used, and otherwise a brief
        reminder of -h is displayed.  When -h is used, write to stdout so
        that you can do `python -h | more'.
      
      Notes:
      
      - I don't want to use the -W option to control whether the classic
        division warning is issued or not, because the machinery to decide
        whether to display the warning or not is very expensive (it involves
        calling into the warnings.py module).  You can use -Werror to turn
        the warnings into exceptions though.
      
      - The -Dnew option doesn't select future division for all of the
        program -- only for the __main__ module.  I don't know if I'll ever
        change this -- it would require changes to the .pyc file magic
        number to do it right, and a more global notion of compiler flags.
      
      - You can usefully combine -Dwarn and -Dnew: this gives the __main__
        module new division, and warns about classic division everywhere
        else.
      393661d1
    • Guido van Rossum's avatar
      Fix a memory leak in str_subtype_new(). (All the other · 29d55a38
      Guido van Rossum authored
      xxx_subtype_new() functions are OK, but I goofed up in this one. :-( )
      29d55a38
    • Guido van Rossum's avatar
      bfa47b07
  5. 30 Aug, 2001 5 commits