https://bugs.kde.org/show_bug.cgi?id=385711

            Bug ID: 385711
           Summary: Wrong parameters marked optional if function has both
                    default arg values and *args
           Product: kdev-python
           Version: 5.1.2
          Platform: Debian testing
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Language support
          Assignee: m...@svenbrauch.de
          Reporter: nicolas.alva...@gmail.com
  Target Milestone: ---

Given a function like this:

    def foo(a, b=2, c=3): pass

the tooltip shows:

    None foo( mixed a, int b = ..., int c = ... )

and code completion on a call to foo shows:

    foo(a, [b, c])

which is correct. However, if the function declaration contains *args to hold
all remaining arguments, the code completion shows the wrong set of parameters
as being optional. Example:

    def bar(a, b=2, c=3, *args): pass

tooltip shows:

    None bar( mixed a, int b, int c = ..., tuple of () args = ... )

and code completion on a call to bar shows:

    bar(a, b, [c, args])

which incorrectly shows b as a required parameter.

Having both *args and **kwargs shifts the brackets further, so both b and c are
incorrectly shown as required:

    def baz(a, b=2, c=3, *args, **kwargs): pass

    baz(a, b, c, [args, kwargs])


The exact same problem happens for methods in a class, so bug 369369 seems
unrelated, but make sure it doesn't regress when this one is fixed.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to