Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Eric Matthes
Eric Matthes
@ehmatthes@fosstodon.org  ·  activity timestamp 3 weeks ago

#Python people, I have a question about names. In the following example, what do you call the first line of this function (everything from `def` through the colon)?

Followup question: When someone refers to the "function definition" does that make you think of the entire function, or just part of it?

def report_observation(bird: str) -> str:
    """Report a birding observation."""
    return f"A {bird} was seen during the count period."

msg = report
print(msg)
def report_observation(bird: str) -> str: """Report a birding observation.""" return f"A {bird} was seen during the count period." msg = report print(msg)
def report_observation(bird: str) -> str: """Report a birding observation.""" return f"A {bird} was seen during the count period." msg = report print(msg)
  • Copy link
  • Flag this post
  • Block
phildini
phildini
@phildini@wandering.shop  ·  activity timestamp 3 weeks ago

@ehmatthes before looking at replies: “function signature”

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.32 no JS en
Federation disabled
Log in
Instance logo
  • Explore
  • About
  • Members
  • Code of Conduct