On Fri, Sep 17, 2021 at 3:20 AM Mostowski Collapse <burse...@gmail.com> wrote: > > Compound is not used for boxing. Integers and floats > are represented directly. Also integers are not mapped to > floats. But maybe compound could be a little flattened, >
"Boxing" in this case isn't about ints and floats, since Java-like bizarrenesses simply don't happen in Python; I'm talking about the way that you frequently build up a Compound object for various situations (even for throwing an error - you have a function that constructs a generic Exception, and then buries a Compound inside it), and then you're frequently checking if something is an instance of Compound. All these constant back-and-forths are extremely expensive, since they're not part of your algorithm at all. At very least, use tuples instead of Compounds, but it would be far better to ask less questions about your data and do more things by tidying up your algorithm. Unfortunately, I can't really advise with any detail, because you have code like this: ### # Mark a term. # # @param term The term. ## def mark_term(term): What does that even mean?! I get it, you have a term, and you're marking it. Whatever that mark means. The comments add absolutely nothing that the function header didn't tell me. Are you implementing your own garbage collection on top of Python's? Or something else? It's extremely hard to give any sort of recommendations when your code is hard to read, and nearly all of the comments are nothing more than restating what can be seen in the next line of code. Also, with the number of globals you're using, tracing the purpose of your functions is not easy. ChrisA -- https://mail.python.org/mailman/listinfo/python-list