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

var('x',ns=False) -- should go boom but silently gives a new symbolic variable #6340

Closed
williamstein opened this issue Jun 16, 2009 · 22 comments

Comments

@williamstein
Copy link
Contributor

sage: type(var('x',ns=False))
<type 'sage.symbolic.expression.Expression'>

Component: calculus

Author: Karl-Dieter Crisman

Reviewer: Jason Grout, Burcin Erocal

Merged: Sage 4.1.2.alpha4

Issue created by migration from https://trac.sagemath.org/ticket/6340

@williamstein
Copy link
Contributor Author

comment:1

The fix should be to raise a DeprecationError... or possibly just a NotImplementedError...

@kcrisman
Copy link
Member

comment:2

This raises a NotImplementedError for ns=False, but still creates the variable for ns=1 or ns=True, with a verbose level 0 message.

@golam-m-hossain
Copy link

comment:3

Patch at #6559 enhances symbolic variables definition. Unfortunately, the patch there
will conflict with the patch here.

@kcrisman
Copy link
Member

kcrisman commented Sep 6, 2009

comment:4

It looks like #6559 functionality is better to incorporate first. What happens after its inclusion with the following?

sage: var('z',ns=False)
sage: var('z',ns=True)

The results of these will help create a new patch, though that may not happen for a bit.

Alternately, since this one is small, one could review it positively (if it deserves to be) :) and then base the bigger patch at #6559 on it.

@kcrisman
Copy link
Member

Based on 4.1.1 and #6559

@kcrisman
Copy link
Member

comment:5

Attachment: trac_6340-var-ns-based-6559.patch.gz

Depending on which one is reviewed first, here's a patch on top of #6559. Should work identically.

@jasongrout
Copy link
Member

comment:6

This should use the deprecation function instead of the verbose function.

For example (from matrix_rational_dense.pyx)

        from sage.misc.misc import deprecation
        deprecation("'invert' is deprecated; use 'inverse' instead.")

@burcin
Copy link

burcin commented Sep 22, 2009

comment:7

I think NotImplementedError is OK for ns=False, but we should use a deprecation warning for ns=1.

@kcrisman
Copy link
Member

comment:8

This makes sense. I've updated the first patch as per Burcin's idea, which seems most appropriate.

@kcrisman
Copy link
Member

Author: Karl-Dieter Crisman

@burcin
Copy link

burcin commented Sep 22, 2009

comment:9

Sorry for not pointing this out earlier, but I suggest changing the block:

    if ('ns', False) in kwds.items(): 
        raise NotImplementedError, "The new (Pynac) symbolics are now the only symbolics; please do not use keyword `ns` any longer." 
    if ('ns', True) in kwds.items(): 
        from sage.misc.misc import deprecation 
        deprecation("The new (Pynac) symbolics are now the only symbolics; please do not use keyword 'ns' any longer.") 

with

    if kwds.has_key('ns'):
        if kwds['ns']:
            from sage.misc.misc import deprecation 
            deprecation("The new (Pynac) symbolics are now the only symbolics; please do not use keyword 'ns' any longer.") 
        else:
            raise NotImplementedError, "The new (Pynac) symbolics are now the only symbolics; please do not use keyword `ns` any longer." 

Even if kwds is expected to be empty, it is a waste to call .items().

Putting a check that *args is empty would also help. Dropping arguments silently is not very user friendly.

@kcrisman
Copy link
Member

comment:10

Yes, I knew there was a more elegant way to do it, but didn't have time to look it up. As for *args, I think I can safely get rid of that completely, since there are no args, only keywords. Patch coming up.

@kcrisman
Copy link
Member

Based on 4.1.2.alpha2

@kcrisman
Copy link
Member

comment:11

Attachment: trac_6340-var-ns.patch.gz

This should take care of it, I hope.

@burcin
Copy link

burcin commented Sep 22, 2009

Attachment: trac_6340-missing_bits.patch.gz

more doctest fixes

@burcin
Copy link

burcin commented Sep 22, 2009

Reviewer: Jason Grout, Burcin Erocal

@burcin
Copy link

burcin commented Sep 22, 2009

comment:12

Looks good to me. AFAICT, there were two more places using the ns=1 option. attachment: trac_6340-missing_bits.patch should take care of them.

Apply only

@kcrisman
Copy link
Member

comment:13

To release manager: the "missing bits" may be covered in other patches reviewed related to symbolics, so do not merge if that one won't merge (simple enough!).

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 24, 2009

comment:14

Merged trac_6340-var-ns.patch.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 24, 2009

Merged: Sage 4.1.2.alpha3

@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Sep 24, 2009
@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 27, 2009

Changed merged from Sage 4.1.2.alpha3 to Sage 4.1.2.alpha4

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 27, 2009

comment:15

There is no 4.1.2.alpha3. Sage 4.1.2.alpha3 was William Stein's release for working on making the notebook a standalone package.

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

No branches or pull requests

5 participants