Skip to content

Commit

Permalink
Add mmatera's observation ...
Browse files Browse the repository at this point in the history
about the use of $Context and $ContextPath in normal operation
  • Loading branch information
rocky committed Nov 17, 2024
1 parent 95194ff commit 4fc61c7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mathics/core/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,16 @@ def get_attributes(self, definitions):
return definitions.get_attributes(self.name)

def get_name(self, short=False) -> str:
"""
Returns symbol's name field. If short=True
we strip off the context parts.
Note however that many places in the code we do not need the
"short" parameter becasue of Definitions.shorten_name() which
keeps track of the current $Context and $ContextPath to decide
whether the name of a symbol should or should not be
shortened.
"""
return self.name.split("`")[-1] if short else self.name

def get_sort_key(self, pattern_sort=False) -> tuple:
Expand Down

0 comments on commit 4fc61c7

Please sign in to comment.