Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question on using for
#5
(Jun-17-2018, 03:42 PM)Nwb Wrote: _ is also assigned the last mathematical call (ex: 2+2, _ is 4) in IDLE. _ should never be used as a variable.

It is assigned the value of the last executed expression that produces result which is not None - e.g. print and assignment will not set _. It is often used as a placeholder variable by some people with some experience (me among them) - e.g., in IDEs it will prevent linters from screaming at you that you create an unused variable.

Please, try to grow beyond the newbie level before making sweeping statements
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.


Messages In This Thread
question on using for - by tryingtolearnpython - Jun-17-2018, 11:28 AM
RE: question on using for - by Nwb - Jun-17-2018, 11:49 AM
RE: question on using for - by buran - Jun-17-2018, 11:57 AM
RE: question on using for - by Nwb - Jun-17-2018, 03:42 PM
RE: question on using for - by volcano63 - Jun-17-2018, 03:54 PM
RE: question on using for - by ichabod801 - Jun-17-2018, 06:35 PM
RE: question on using for - by volcano63 - Jun-17-2018, 07:55 PM
RE: question on using for - by ichabod801 - Jun-17-2018, 08:47 PM
RE: question on using for - by tryingtolearnpython - Jun-18-2018, 07:17 AM
RE: question on using for - by Nwb - Jun-18-2018, 10:12 AM
RE: question on using for - by volcano63 - Jun-18-2018, 01:35 PM
RE: question on using for - by DeaD_EyE - Jun-18-2018, 10:51 AM
RE: question on using for - by volcano63 - Jun-18-2018, 06:46 PM
RE: question on using for - by buran - Jun-18-2018, 03:52 PM
RE: question on using for - by Nwb - Jun-22-2018, 02:46 AM
RE: question on using for - by buran - Jun-22-2018, 05:00 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020