Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
empty arguments
#4
(Apr-27-2017, 07:26 AM)buran Wrote: Note that you should not supply mutable default arguments, e.g.
def parseVote(s=[]):
THAT'S NOT THE RIGHT WAY

Actually, in some very specific cases this is the right way - if you build a caching mechanism. Though in those cases I would use underscored name.
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.
Reply


Messages In This Thread
empty arguments - by noob - Apr-27-2017, 07:16 AM
RE: empty arguments - by buran - Apr-27-2017, 07:26 AM
RE: empty arguments - by volcano63 - Apr-27-2017, 11:26 AM
RE: empty arguments - by noob - Apr-27-2017, 07:37 AM
RE: empty arguments - by wavic - Apr-27-2017, 11:46 AM
RE: empty arguments - by volcano63 - Apr-27-2017, 11:47 AM
RE: empty arguments - by buran - Apr-27-2017, 11:56 AM
RE: empty arguments - by volcano63 - Apr-27-2017, 12:02 PM
RE: empty arguments - by micseydel - Apr-27-2017, 05:02 PM
RE: empty arguments - by volcano63 - Apr-28-2017, 03:31 AM
RE: empty arguments - by micseydel - Apr-28-2017, 06:07 AM
RE: empty arguments - by volcano63 - Apr-28-2017, 09:47 AM
RE: empty arguments - by nilamo - May-11-2017, 04:03 PM
RE: empty arguments - by volcano63 - May-11-2017, 05:20 PM
RE: empty arguments - by micseydel - May-11-2017, 05:31 PM
RE: empty arguments - by volcano63 - May-11-2017, 05:36 PM
RE: empty arguments - by micseydel - May-11-2017, 10:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Functions (Arguments Passing,Changing a mutable ,Assignment to Arguments Names) Adelton 2 3,918 Mar-02-2017, 10:23 PM
Last Post: zivoni

Forum Jump:

User Panel Messages

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