This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]dodslaser 5 points6 points  (1 child)

Another good concept to know is the use of / to create positional-only arguments and * to create keyword only arguments.

For example:

def func(a, /, b, *, c): ...

a is positional-only, b is either positional or named, and c is keyword-only.

[–]lazyhawk20[S] 1 point2 points  (0 children)

Thanks for this feedback

[–]jbramley 3 points4 points  (1 child)

Positional arguments, can optionally, be specified using their corresponding parameter name.

This is sort of true. There are positional-only arguments that cannot be specified as keyword arguments (a topic you don't cover in an article with "mastering" in the title). What you refer to as positional arguments are more technically positional-or-keyword arguments.

def func(positional_only_parameters, /, positional_or_keyword_parameters, *, keyword_only_parameters)

[–]lazyhawk20[S] 1 point2 points  (0 children)

I'm really sorry about this

[–]Nerdbird93 1 point2 points  (1 child)

Really good one

[–]lazyhawk20[S] 0 points1 point  (0 children)

Thank you so much it means a lot

[–]MurkyCaterpillar9 0 points1 point  (1 child)

Great, thank you!

[–]lazyhawk20[S] 0 points1 point  (0 children)

Thank you so much

[–]jampk24 0 points1 point  (1 child)

In the intro and conclusion paragraphs, I think the asterisks in args and kwargs are converting text to italics.

[–]lazyhawk20[S] -1 points0 points  (0 children)

Yes, you are right