You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenSCAD allows identifiers which are "illegal" python identifiers. For example $fn, import, [MCAD.]2Dshapes.
The cuurent solution to this problem is that all "illegal" identifiers (either python keywords or starting with $ or a digit) get escaped. The escape mechnism prepends a single underscore (e.g. $fn -> _fn, import -> _import, MCAD._2Dshapes). This makes them "legal" python identifiers and everything seemed to be fine.
Buuuuut..... it turned out that the prepending underscore makes objects private in python and private objects don't get exported / imported by default. The result is, that from solid2 import * does -- for example -- not import _import even though it's there.
Atm if you want to use such a entity you have to explicitly import it:
We need to prepend something (because of for example 2Dshapes) and I don't like to prepend sp_ or similar. Furthermore I don't want to make breaking changes again to fix this issue.
So I'm sorry for this bad decision I made some time ago, but that's life.
If anyone has any ideas, let me know.
The text was updated successfully, but these errors were encountered:
if explicit import lists solve the issue, that would mean, that we
would need to create explicit import lists for everything (since the
top level namespace would need it).... that sounds like a lot of
work and book keeping...
OpenSCAD allows identifiers which are "illegal" python identifiers. For example
$fn
,import
,[MCAD.]2Dshapes
.The cuurent solution to this problem is that all "illegal" identifiers (either python keywords or starting with
$
or a digit) get escaped. The escape mechnism prepends a single underscore (e.g.$fn -> _fn
,import -> _import
,MCAD._2Dshapes
). This makes them "legal" python identifiers and everything seemed to be fine.Buuuuut..... it turned out that the prepending underscore makes objects private in python and private objects don't get exported / imported by default. The result is, that
from solid2 import *
does -- for example -- not import_import
even though it's there.Atm if you want to use such a entity you have to explicitly import it:
I don't have any solution for this issue (yet).
We need to prepend something (because of for example
2Dshapes
) and I don't like to prependsp_
or similar. Furthermore I don't want to make breaking changes again to fix this issue.So I'm sorry for this bad decision I made some time ago, but that's life.
If anyone has any ideas, let me know.
The text was updated successfully, but these errors were encountered: