Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nonlocal_without_binding.py 842B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """ Checks that reversed() receive proper argument """
  2. # pylint: disable=missing-docstring,invalid-name,unused-variable
  3. # pylint: disable=too-few-public-methods,no-self-use,no-absolute-import
  4. def test():
  5. def parent():
  6. a = 42
  7. def stuff():
  8. nonlocal a
  9. c = 24
  10. def parent2():
  11. a = 42
  12. def stuff():
  13. def other_stuff():
  14. nonlocal a
  15. nonlocal c
  16. b = 42
  17. def func():
  18. def other_func():
  19. nonlocal b # [nonlocal-without-binding]
  20. class SomeClass(object):
  21. nonlocal x # [nonlocal-without-binding]
  22. def func(self):
  23. nonlocal some_attr # [nonlocal-without-binding]
  24. def func2():
  25. nonlocal_ = None
  26. local = None
  27. class Class:
  28. nonlocal nonlocal_
  29. nonlocal_ = 1
  30. local = 1
  31. return local + nonlocal_