Python Forum
passing an argument to avoid a global
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing an argument to avoid a global
#10
i still don't understand decorators so i'm looking at DeaD_EyE's 2nd example. suppose the sort key function is a function where i am padding those strings from re.split() that are decimal strings. there needs to be a consistent length of the padding across all records. the code that calls sorted(...,key=) would set up that length in a way that they key function could get it. then it would pad those decimal strings so they all are consistent. is that what the argument is for in line 9? i don't follow what lines 5 and 6 are doing.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
passing an argument to avoid a global - by Skaperen - Jul-11-2019, 06:21 AM
RE: passing an argument to avoid a global - by Skaperen - Jul-12-2019, 11:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Passing Argument Errors cosmarchy 6 2,470 Sep-29-2021, 06:09 AM
Last Post: snippsat
  Passing argument from top-level function to embedded function JaneTan 2 2,284 Oct-15-2020, 03:50 PM
Last Post: deanhystad
  SyntaxError: positional argument follows keyword argument syd_jat 3 5,866 Mar-03-2020, 08:34 AM
Last Post: buran
  Passing an argument by reference Exsul 12 4,748 Aug-22-2019, 07:29 AM
Last Post: DeaD_EyE
  Global variable does not seem to be global. Columbo 6 3,731 Jul-15-2019, 11:00 PM
Last Post: Columbo
  help with threading module and passing global variables ricardons 1 7,883 Feb-21-2019, 12:48 PM
Last Post: stullis
  Is This Code Ok? How Can I Avoid Using Global Variables? digitalmatic7 9 5,869 Feb-15-2018, 09:32 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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