Python Forum
'namespace' shorthand for function arguments?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'namespace' shorthand for function arguments?
#6
(Aug-10-2021, 08:18 PM)deanhystad Wrote: I understand the concern. By using lots of attributes in an object that was passed in as an argument your updatevalue method becomes strongly tied to the design of the cards class. This is not good for long term maintenance and it limits the usefulness of the function.

I don't think your problem is with using attributes of a class. I think updatevalue is poorly designed. A key tenet of software design is that each function has a well defined purpose. What is the purpose of updatevalue? Can you describe it in one or two short sentences?

The decision tree for blackjack isn't very uniform and I realized at one point I needed a final value for a hand that could not be resolved based on the cards alone, but also required the user to make choices (in this case about downgrading Aces) and work later routines based on the final value alone.

I'm not a very good strategic thinker so doing a lot of up front planning for something even as simple as blackjack is an exercise in constantly learning where to draw the lines between what does where, AFTER I start programming.
Reply


Messages In This Thread
RE: 'namespace' shorthand for function arguments? - by shadowphile - Aug-11-2021, 09:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  which namespace? Skaperen 5 232 May-28-2024, 05:38 AM
Last Post: Gribouillis
  calling external function with arguments Wimpy_Wellington 7 1,608 Jul-05-2023, 06:33 PM
Last Post: deanhystad
  If with For statement shorthand? kaega2 5 1,212 Sep-06-2022, 08:12 PM
Last Post: Gribouillis
  Checking the number of arguments a function takes Chirumer 3 2,262 Jul-06-2021, 04:56 PM
Last Post: Chirumer
  Possible to dynamically pass arguments to a function? grimm1111 2 2,289 Feb-21-2021, 05:57 AM
Last Post: deanhystad
  [PyKML] Loop through all Placemarks; Remove namespace Winfried 2 3,532 Aug-28-2020, 09:24 AM
Last Post: Winfried
  How to pass multiple arguments into function Mekala 4 2,539 Jul-11-2020, 07:03 AM
Last Post: Mekala
  How to give a name to function arguments in C-API? WonszZeczny 0 1,391 Jun-22-2020, 10:20 AM
Last Post: WonszZeczny
  cant understand the logic behind shorthand form of operator pradeep_sn 2 1,808 May-20-2020, 06:53 PM
Last Post: buran
  Function Recognises Variable Without Arguments Or Global Variable Calling. OJGeorge4 1 2,336 Apr-06-2020, 09:14 AM
Last Post: bowlofred

Forum Jump:

User Panel Messages

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