FastBinaryEncoding
FastBinaryEncoding copied to clipboard
Small issue with generated python code
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