Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Feedback Is it harmful to use multiple type-casting in Python?

Discussion in 'Code Editors & IDEs' started by Soham1087, Nov 15, 2022.

Thread Status:
Not open for further replies.
  1. Soham1087

    Soham1087

    Joined:
    Jun 13, 2022
    Posts:
    5
    Assume I have a Python variable called my_boolean = False. My desired outcome is: my_bool = "0" This is the only method I can conceive of accomplishing it. my_bool = str(int(my_boolean)) is a double type-casting.
    Is there a better way to go about this?
    Can I use Python's str() function to convert a given value or object into a string object using Type Casting?
     
  2. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    908
    Stop treating this forum as a general programming forum.
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,761
    As above, these forums are for Unity, not general programming. You even posted it on a sub-forum related to code-editors. This is the second time you've been asked not to do this.
     
Thread Status:
Not open for further replies.