| Tor Norbye | 3a2425a | 2013-11-04 10:16:08 -0800 | [diff] [blame] | 1 | def foo(a, b = 345, c = 1): |
| 2 | pass |
| 3 | |
| 4 | foo(1, <weak_warning descr="Argument equals to default parameter value">345</weak_warning>, 22) |
| 5 | |
| 6 | def foo(a = None): |
| 7 | pass |
| 8 | foo(<weak_warning descr="Argument equals to default parameter value">a = None</weak_warning>) |
| 9 | |
| 10 | def bar(a = 2, b = 3): |
| 11 | pass |
| 12 | |
| 13 | #PY-3260 |
| 14 | bar(<weak_warning descr="Argument equals to default parameter value">a = 2</weak_warning>, <weak_warning descr="Argument equals to default parameter value">b = 3</weak_warning>) |
| 15 | |
| 16 | class A: |
| 17 | @classmethod |
| 18 | def foo(cls, a = 1): |
| 19 | pass |
| 20 | |
| 21 | a = A() |
| 22 | |
| 23 | a.foo(<weak_warning descr="Argument equals to default parameter value">1</weak_warning>) |
| 24 | |
| 25 | |
| 26 | class C(object): |
| 27 | def __init__(self): |
| 28 | self._x = None |
| 29 | |
| 30 | def getx(self): |
| 31 | return self._x |
| 32 | def setx(self, value): |
| 33 | self._x = value |
| 34 | def delx(self): |
| 35 | del self._x |
| 36 | |
| 37 | x = property(getx, <weak_warning descr="Argument equals to default parameter value">None</weak_warning>, fdel = delx, doc = "I'm the 'x' property.") |
| 38 | |
| 39 | |
| 40 | # PY-3455 |
| 41 | import optparse |
| 42 | |
| 43 | class Option(optparse.Option): |
| 44 | pass |
| 45 | |
| 46 | class OptionParser(optparse.OptionParser): |
| 47 | def __init__(self): |
| 48 | optparse.OptionParser.__init__(self, option_class=Option) |
| 49 | |
| 50 | ## |
| 51 | |
| 52 | def bar(a = "qwer"): |
| 53 | pass |
| 54 | |
| 55 | bar(<weak_warning descr="Argument equals to default parameter value">a = 'qwer'</weak_warning>) |
| 56 | |
| 57 | getattr(bar, "__doc__", None) # None is not highlighted |
| 58 | |
| 59 | class a: |
| 60 | def get(self, a, b = None): |
| 61 | pass |
| 62 | |
| 63 | kw = a() |
| 64 | |
| 65 | kw['customerPaymentProfileId'] = kw.get("customerPaymentProfileId", |
| 66 | <weak_warning descr="Argument equals to default parameter value">None</weak_warning>) |
| 67 | |
| 68 | {1: 2}.get('foo', None) #pass |
| 69 | {1: 2}.pop('foo', None) #pass |