Opened 12 years ago
Last modified 12 years ago
#8317 new enhancement
Prevent assignments to special names
Reported by: | olazo | Owned by: | olazo |
---|---|---|---|
Priority: | major | Milestone: | sage-wishlist |
Component: | misc | Keywords: | assignation, names |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
I'd like to propose that certain special names should be protected so that they could not become variable names (for example pi, e, and i)
if by accident you assign them like:
sage: e=factorial(10)
and then you need to need to use e with it's standard meaning, like
sage: e^100
you will have a very hard time finding the error ( factorial(10)^100
).
this has been discussed in: http://groups.google.com/group/sage-support/browse_thread/thread/b391ed6bd14cdfd0
and
http://groups.google.com/group/sage-devel/browse_thread/thread/a8e1e4ffe24840dc
Change History (4)
comment:1 Changed 12 years ago by
- Component changed from misc to symbolics
- Description modified (diff)
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
- Component changed from symbolics to misc
- Milestone set to sage-wishlist
- Summary changed from Protecting special names against assignation to Prevent assignments to special names
- Type changed from defect to enhancement
I see that this would be a desirable feature for users of symbolics. I don't think the implementation is related to the symbolics subsystem however. I'm assigning this back to the misc component.
comment:4 Changed 12 years ago by
- Description modified (diff)
- Priority changed from minor to major
his is something that can (and will) be made an optional mode. We'll have several -- implicit multiplication, automatic variable name creation, and protected names. Having them all on could be useful for people teaching, e.g., calculus labs. This protected mode, by the way, will in the long run use the same technique as automatic variable name creation: replacing the globals() dictionary by a customized wrapper. This has a slight performance penalty, so definitely can't be the default. But it is a fine idea for an optional mode.