Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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:
    426
    Stop treating this forum as a general programming forum.
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,129
    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.