A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-June/036101.html below:

[Python-Dev] Re: PEP-317

[Python-Dev] Re: PEP-317Raymond Hettinger python@rcn.com
Mon, 9 Jun 2003 21:07:48 -0400
> Btw, just to be clear: in pure Python, deferred instantiation is
> already impossible; implicit instantiation is exactly equivalent
> to explicit.

Almost exactly:

>>> def f():
 raise ValueError, 1

>>> def g():
 raise ValueError(1)

>>> from dis import dis
>>> dis(f)
  2           0 LOAD_GLOBAL              0 (ValueError)
              3 LOAD_CONST               1 (1)
              6 RAISE_VARARGS            2
              9 LOAD_CONST               0 (None)
             12 RETURN_VALUE        
>>> dis(g)
  2           0 LOAD_GLOBAL              0 (ValueError)
              3 LOAD_CONST               1 (1)
              6 CALL_FUNCTION            1
              9 RAISE_VARARGS            1
             12 LOAD_CONST               0 (None)
             15 RETURN_VALUE 



On a separate note, I was experimented with explicit instantiation 
and noticed an oddity with my editor's autocomplete.  Upon typing:

    raise TypeError(

the autocompleter looks up the doc string for TypeError and announces:

    Inappropriate argument type

when you were likely expecting to be prompted for the exception value.
Perhaps the doc string should read like this:

   TypeError([exceptionvalue]) --> Exception for inappropriate argument type.



Raymond Hettinger




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4