CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
2.93k stars 276 forks source link

CadQuery Enhancement Proposal (CQEP 00X) - Change union types into X | Y #1518

Open huskier opened 5 months ago

huskier commented 5 months ago

In Python 3.10, the | symbol was brought to represent Union types (PEP 604). The | symbol strikes a balance between clarity, consistency, and convenience, making it a fitting choice for representing Union types in Python. It aligns with mathematical conventions, promotes concise code, and harmonizes with other programming languages, fostering a seamless developer experience.

I propose we change union types into (X | Y) during CadQuery 2.5 development cycle. For the Optional keyword, I suggest keep it as is for consistent with other programming languages and for aesthetics.

To make the change happen, the Python version requirement has to be increased to 3.10. We do not know how this influence the CadQuery ecosystem.

If the proposal is accepted, I'd like to do a pull request for the changes.

adam-urbanczyk commented 4 months ago

I'd like to have it eventually. But for now 3.9 is the minimum version.