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

Small issue with generated python code #96

Open
paulorsouza opened this issue Jan 29, 2024 · 0 comments
Open

Small issue with generated python code #96

paulorsouza opened this issue Jan 29, 2024 · 0 comments

Comments

@paulorsouza
Copy link

paulorsouza commented Jan 29, 2024

Hello @chronoxor , we use fbe in our cpp an c# app, we decided to use in our python app too, but we encountered a small problem.
In our schemes we use the same name as the strucs in the fields on other strucst. This works well in c# and cpp, but in python it creates a shadowing problem.

struct InstrumentId {
   Source Source
   Venue Venue
    ...
}
class InstrumentId(object):
    __slots__ = "Source", "SecurityId", "Symbol", 

    def __init__(self, Source=None, SecurityId=0, Symbol=""):
        if Source is None:
            Source = Source()
        self.Source = Source

Source was shadowed here, I temporarily solve it by changing the field name to _Source, but i'd like to know if you can help us with a definitive solution.

Naively I think that adding prefix to all parameters in init will solve the problem, but I'm not sure.

https://github.com/chronoxor/FastBinaryEncoding/blob/master/source/generator_python.cpp#L3256

Thanks in advance for your attention

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

No branches or pull requests

1 participant