Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color Error when the inputs are partly int #1310

Open
ZacZhangzhuo opened this issue Mar 13, 2024 · 4 comments
Open

Color Error when the inputs are partly int #1310

ZacZhangzhuo opened this issue Mar 13, 2024 · 4 comments
Assignees
Labels

Comments

@ZacZhangzhuo
Copy link
Contributor

ZacZhangzhuo commented Mar 13, 2024

Describe the bug
As titled.

To Reproduce

from compas.colors import Color

color = Color(0.0,0.0,0)

print(Color.coerce(color))
 File "\compas\src\compas\colors\color.py", line 585, in coerce
    raise ColorError
 compas.colors.color.ColorError
@jf---
Copy link
Contributor

jf--- commented Apr 6, 2024

@tomvanmele the current implementation coerces str int and float as an argument.
this screams for a refactor with typing.overload which was introduced in py 3.5.

implementing type specific versions of the function is much cleaner IMO.
this could be a nice segue to introduce overload

@tomvanmele
Copy link
Member

that would indeed be very nice, but unfortunately, COMPAS 2.x still has to maintain compatibility with IronPython. once we start COMPAS 3 (which will be soon), we can start using this kind of mechanism...

@jf---
Copy link
Contributor

jf--- commented Apr 8, 2024

Terrific, could you pls label it as compas_3 as a reminder to self?

@tomvanmele tomvanmele self-assigned this Apr 8, 2024
@tomvanmele
Copy link
Member

sure done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants