Welcome to TalkGraphics.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2022
    Posts
    4

    Default Difference between {} and () when defining functions,classes, modules, etc. in Python

    When you use {} then you are defining a set or a dictionary or a comprehension for a set or dict.

    When you use () then you are defining a tuple, or a function, or a generator expression, or calling a function.

    They are different parts of syntax that do different things - you can’t use them interchangeably.

  2. #2
    Join Date
    Feb 2007
    Location
    UK
    Posts
    21,283

    Default Re: Difference between {} and () when defining functions,classes, modules, etc. in Py

    so what have you got against index brackets, or did you leave them out because you didn't see the need to go the full monty, python
    -------------------------------
    Nothing lasts forever...

  3. #3
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,487

    Default Re: Difference between {} and () when defining functions,classes, modules, etc. in Py

    I'm not sure the reason for this post. This forum is primarily for users of Xara products. Your profile does not show any Xara products.

    Are you calling someone out for incorrect punctuation? I'm confused here. Help me out. And do you even use brackets in Lahore?

  4. #4
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,746

    Default Re: Difference between {} and () when defining functions,classes, modules, etc. in Py

    If you were to publish this didactic Post in a Python forum, what do you think their response to it might be?
    So far your Threads have had this attitude. TalkGraphics is about an exchange of ideas, you are presently on Transmit.

    For this Post to make a difference for TG members in their design considerations, you need to explain the context of Python's use in those designs. Practical examples will help your case.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  5. #5
    Join Date
    Feb 2007
    Location
    UK
    Posts
    21,283

    Default Re: Difference between {} and () when defining functions,classes, modules, etc. in Py

    it smacks of being lifted straight out of a tutorial/manual text

    out of context it just states the obvious [ to a python programmer]
    -------------------------------
    Nothing lasts forever...

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •