[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Python 2.1a1
From:       Dan Parisien <dan () eevolved ! com>
Date:       2001-02-14 20:49:06
[Download RAW message or body]

On Wednesday 14 February 2001 14:36, you wrote:
> Marco Seiriö wrote:
> > Hello,
> >
> > The latest Python 2.1a1 does not seem to mix well with the
> > latest PyQT bindings.
> >
> > No programs using slots and signals seems to work. Python just
> > complains that the slot has not the same type as the signal.
> >
> > All programs, my own tests, and things like Eric.. seems to
> > be affected by this...
> >
> > Bug in Python or PyQt????
>
> I haven't used Python 2.1 yet - I tend to wait for the Betas. It is
> likely to be a change in Python that hasn't maintained backwards
> compatibility.
>
> Phil
Most propably has to do with http://python.sourceforge.net/peps/pep-0227.html

>From "examples" about half-way down the page.
"""
    A few examples are included to illustrate the way the rules work.

    >>> def make_fact():
    ...     def fact(n):
    ...         if n == 1:
    ...             return 1L
    ...         else:
    ...             return n * fact(n - 1)
    ...     return fact
    >>> fact = make_fact()
    >>> fact(7)    
    5040L

    >>> def make_adder(base):
    ...     def adder(x):
    ...         return base + x
    ...     return adder
    >>> add5 = make_adder(5)
    >>> add5(6)
    11

    >>> def make_wrapper(obj):
    ...     class Wrapper:
    ...         def __getattr__(self, attr):
    ...             if attr[0] != '_':
    ...                 return getattr(obj, attr)
    ...             else:
    ...                 raise AttributeError, attr
    ...     return Wrapper()
    >>> class Test:
    ...     public = 2
    ...     _private = 3
    >>> w = make_wrapper(Test())
    >>> w.public
    2
    >>> w._private
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    AttributeError: _private

    An example from Tim Peters of the potential pitfalls of nested scopes
    in the absence of declarations:

    i = 6
    def f(x):
        def g():
            print i
        # ...
        # skip to the next page
        # ...
        for i in x:  # ah, i *is* local to f, so this is what g sees
            pass
        g()

    The call to g() will refer to the variable i bound in f() by the for
    loop.  If g() is called before the loop is executed, a NameError will
    be raised.
"""

and this quote is quite telling:
"""
   The proposed changes will break backwards compatibility for some
    code.  The following example from Skip Montanaro illustrates:

    x = 1
    def f1():
        x = 2
        def inner():
            print x
        inner()
"""
> _______________________________________________
> PyKDE mailing list    PyKDE@mats.gmd.de
> http://mats.gmd.de/mailman/listinfo/pykde


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic