Right! had forgotten about internationalization. I don' really see both cases collide though. At least not visually. As a matter of reassignment it does though. Aliasing in that case is up to the user in that case though. Depending on local conventions.
============================================
# CASE 1
def myfunc():
return 1, 2
a, _ = myfunc()
# CASE 2
def myfunc():
return 'something'
_ = myfunc() # Func returns something I dont care
# about in this particular case.
# CASE 3
# Catching the first elements with a, b, *remainder = (...) is fine. But in
# this case we have to define a placeholder to access the first and third
# element ignoring the second. Checker then tells us that that the second
# element is unused in code block to follow.
def myfunc():
return (1, 2, 3)
a, _, b = myfunc()
# Could be also used for unpacking of tuples, but thats a case where it
# would be probably better to stick to slicing.
# naming alternative
import internationalization as tl
print(tl('internationalized string'))
_ = myfunc()
def func_causing_problems():
_ = myfunc()
# ...
return 123
==============================================================================
>>>
undertest.py:3:1: E302 expected 2 blank lines, found 1
undertest.py:9:1: E302 expected 2 blank lines, found 1
undertest.py:20:1: E302 expected 2 blank lines, found 1
undertest.py:42:5: F841 local variable '_' is assigned to but never used
1) global scope: OK
2) local scope: <F841>
flake8 version: 2.1.0-2
pyflakes version: 0.8.1-1
All from debian jessie/sid.
Right! had forgotten about internationaliz ation. I don' really see both cases collide though. At least not visually. As a matter of reassignment it does though. Aliasing in that case is up to the user in that case though. Depending on local conventions.
======= ======= ======= ======= ======= ======= ==
# CASE 1
def myfunc():
return 1, 2
a, _ = myfunc()
# CASE 2
def myfunc():
return 'something'
_ = myfunc() # Func returns something I dont care
# about in this particular case.
# CASE 3
# Catching the first elements with a, b, *remainder = (...) is fine. But in
# this case we have to define a placeholder to access the first and third
# element ignoring the second. Checker then tells us that that the second
# element is unused in code block to follow.
def myfunc():
return (1, 2, 3)
a, _, b = myfunc()
# Could be also used for unpacking of tuples, but thats a case where it
# would be probably better to stick to slicing.
def myfunc(): ation as _ _("internationa lized string"))
# mentioned usecase
import internationaliz
print(
# naming alternative ation as tl tl('internation alized string'))
import internationaliz
print(
_ = myfunc()
def func_causing_ problems( ):
_ = myfunc()
# ...
return 123
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= =
>>>
undertest.py:3:1: E302 expected 2 blank lines, found 1
undertest.py:9:1: E302 expected 2 blank lines, found 1
undertest.py:20:1: E302 expected 2 blank lines, found 1
undertest.py:42:5: F841 local variable '_' is assigned to but never used
1) global scope: OK
2) local scope: <F841>
flake8 version: 2.1.0-2
pyflakes version: 0.8.1-1
All from debian jessie/sid.