Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80898 > unrolled thread
| Started by | Pavel Volkov <sailor@lists.xtsubasa.org> |
|---|---|
| First post | 2014-11-16 16:01 +0300 |
| Last post | 2014-11-16 20:49 -0500 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.lang.python
Using map() Pavel Volkov <sailor@lists.xtsubasa.org> - 2014-11-16 16:01 +0300
Re: Using map() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-17 11:09 +1100
Re: Using map() Ned Batchelder <ned@nedbatchelder.com> - 2014-11-16 19:24 -0500
Re: Using map() Chris Angelico <rosuav@gmail.com> - 2014-11-17 12:08 +1100
Messages from code analysis tools (was: Using map()) Ben Finney <ben+python@benfinney.id.au> - 2014-11-17 12:21 +1100
Re: Using map() Dan Stromberg <drsalists@gmail.com> - 2014-11-16 17:31 -0800
Re: Messages from code analysis tools (was: Using map()) Chris Angelico <rosuav@gmail.com> - 2014-11-17 12:36 +1100
Re: Messages from code analysis tools Ned Batchelder <ned@nedbatchelder.com> - 2014-11-16 20:49 -0500
| From | Pavel Volkov <sailor@lists.xtsubasa.org> |
|---|---|
| Date | 2014-11-16 16:01 +0300 |
| Subject | Using map() |
| Message-ID | <mailman.15896.1416169228.18130.python-list@python.org> |
I checked my modules with pylint and saw the following warning: W: 25,29: Used builtin function 'map' (bad-builtin) Why is the use of map() discouraged? It' such a useful thing.
[toc] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-11-17 11:09 +1100 |
| Message-ID | <54693cc4$0$13000$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #80898 |
Pavel Volkov wrote: > I checked my modules with pylint and saw the following warning: > > W: 25,29: Used builtin function 'map' (bad-builtin) > > Why is the use of map() discouraged? > It' such a useful thing. That's a bug in pylint. It's not a bad builtin, it is perfectly fine. Some people don't like map. Pay no attention to them. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2014-11-16 19:24 -0500 |
| Message-ID | <mailman.15924.1416183892.18130.python-list@python.org> |
| In reply to | #80932 |
On 11/16/14 7:09 PM, Steven D'Aprano wrote:
> Pavel Volkov wrote:
>
>> I checked my modules with pylint and saw the following warning:
>>
>> W: 25,29: Used builtin function 'map' (bad-builtin)
>>
>> Why is the use of map() discouraged?
>> It' such a useful thing.
>
> That's a bug in pylint. It's not a bad builtin, it is perfectly fine.
>
> Some people don't like map. Pay no attention to them.
Pylint isn't useful until you've tailored the messages. Personally, I
avoid map, but your usage may vary. The pylint message that always
irked me was:
W0142: Used * or ** magic
"magic"? They're features of the language! Meanwhile, it doesn't mind
if you write multiply-inherited metaclasses....
--
Ned Batchelder, http://nedbatchelder.com
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-17 12:08 +1100 |
| Message-ID | <mailman.15928.1416186490.18130.python-list@python.org> |
| In reply to | #80932 |
On Mon, Nov 17, 2014 at 11:24 AM, Ned Batchelder <ned@nedbatchelder.com> wrote: > Pylint isn't useful until you've tailored the messages. Personally, I avoid > map, but your usage may vary. The pylint message that always irked me was: > > W0142: Used * or ** magic This is why I don't bother with linters at all. They're almost always more hassle than they're worth, because no two programmers agree on everything. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2014-11-17 12:21 +1100 |
| Subject | Messages from code analysis tools (was: Using map()) |
| Message-ID | <mailman.15931.1416187280.18130.python-list@python.org> |
| In reply to | #80932 |
Ned Batchelder <ned@nedbatchelder.com> writes: > Pylint isn't useful until you've tailored the messages. Definitely agreed. > The pylint message that always irked me was: > > W0142: Used * or ** magic > > "magic"? They're features of the language! It's a warning, because the use of that feature clobbers the static code inspection you've asked for. PyLint is warning you “because the code uses this feature, I can't say anything about undefined names”. -- \ “The future always arrives too fast, and in the wrong order.” | `\ —Alvin Toffler | _o__) | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Dan Stromberg <drsalists@gmail.com> |
|---|---|
| Date | 2014-11-16 17:31 -0800 |
| Message-ID | <mailman.15934.1416187894.18130.python-list@python.org> |
| In reply to | #80932 |
On Sun, Nov 16, 2014 at 4:09 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Pavel Volkov wrote: > >> I checked my modules with pylint and saw the following warning: >> >> W: 25,29: Used builtin function 'map' (bad-builtin) >> >> Why is the use of map() discouraged? >> It' such a useful thing. > > That's a bug in pylint. It's not a bad builtin, it is perfectly fine. > > Some people don't like map. Pay no attention to them. I actually avoid map. map works as intended; there's nothing particularly wrong with it. In fact I believe it's pretty important in lisp, but it's a rather glaring example of TMTOWTDI in Python. BTW, I believe in Python 2.x map is like a list comprehension, but in 3.x map is like a generator expression.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-17 12:36 +1100 |
| Subject | Re: Messages from code analysis tools (was: Using map()) |
| Message-ID | <mailman.15936.1416188222.18130.python-list@python.org> |
| In reply to | #80932 |
On Mon, Nov 17, 2014 at 12:21 PM, Ben Finney <ben+python@benfinney.id.au> wrote: >> The pylint message that always irked me was: >> >> W0142: Used * or ** magic >> >> "magic"? They're features of the language! > > It's a warning, because the use of that feature clobbers the static code > inspection you've asked for. PyLint is warning you “because the code > uses this feature, I can't say anything about undefined names”. Then that ought surely to be an informational? It's not saying there's a problem in your code, it's pointing out that it can't check. Either that, or warnings from PyLint are all low-grade and should be ignored. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2014-11-16 20:49 -0500 |
| Subject | Re: Messages from code analysis tools |
| Message-ID | <mailman.15937.1416189002.18130.python-list@python.org> |
| In reply to | #80932 |
On 11/16/14 8:21 PM, Ben Finney wrote: > Ned Batchelder <ned@nedbatchelder.com> writes: > >> Pylint isn't useful until you've tailored the messages. > > Definitely agreed. > >> The pylint message that always irked me was: >> >> W0142: Used * or ** magic >> >> "magic"? They're features of the language! > > It's a warning, because the use of that feature clobbers the static code > inspection you've asked for. PyLint is warning you “because the code > uses this feature, I can't say anything about undefined names”. > That's the best explanation I've heard for why they warn about it. I wish they would find a more sophisticated word than "magic". -- Ned Batchelder, http://nedbatchelder.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web