Re: [sage-support] Global variable in Boolean function

2018-02-13 Thread David Joyner
On Tue, Feb 13, 2018 at 1:46 AM,   wrote:
> Input:
> B.
> = BooleanPolynomialRing(order='lex')
> l15=b+b
> print "l15:",l15
> def fun():
>print "l15:",l15
>

I don't get this in 7.6. Instead, I get the expected behavior:


sage: 
B.
= BooleanPolynomialRing(order='lex')

: l15=b+b

: print "l15:",l15

: def fun():

:return "l15:",l15

:

l15: 0


> output:
>
> l15: 0
> l15:
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "_sage_input_13.py", line 10, in 
> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
> -*-\\n" +
> _support_.preparse_worksheet_cell(base64.b64decode("cHJpbnQgImw2MzoiLCBsNjMKS1NBKCk="),globals())+"\\n");
> execfile(os.path.abspath("___code___.py"))
>   File "", line 1, in 
>   File "/tmp/tmprgCX70/___code___.py", line 3, in 
> exec compile(u'fun()
>   File "", line 1, in 
>   File "/tmp/tmpbGAWHq/___code___.py", line 3, in KSA
> print "l15:", l15
> UnboundLocalError: local variable 'l15' referenced before assignment
>
>
> Input:
> B.
> = BooleanPolynomialRing(order='lex')
> l15=b+b
> print "l15:",l15
> def fun():
>
> C.=
> BooleanPolynomialRing(order='lex')
> print "l15:",l15
> output:
> l15: 0
> l15: l15
>
>
> My question is : how can globally i will declare the value of l15?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Global variable in Boolean function

2018-02-12 Thread santu . pal
Input: 
B. 
= BooleanPolynomialRing(order='lex')
l15=b+b
print "l15:",l15
def fun():
   print "l15:",l15

output:

l15: 0
l15:
Traceback (most recent call last):
  File "", line 1, in 
  File "_sage_input_13.py", line 10, in 
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" 
+ 
_support_.preparse_worksheet_cell(base64.b64decode("cHJpbnQgImw2MzoiLCBsNjMKS1NBKCk="),globals())+"\\n");
 execfile(os.path.abspath("___code___.py"))
  File "", line 1, in
  File "/tmp/tmprgCX70/___code___.py", line 3, in 
exec compile(u'fun()
  File "", line 1, in
  File "/tmp/tmpbGAWHq/___code___.py", line 3, in KSA
print "l15:", l15
UnboundLocalError: local variable 'l15' referenced before assignment


Input: 
B. 
= BooleanPolynomialRing(order='lex')
l15=b+b
print "l15:",l15
def fun():

C.=
 BooleanPolynomialRing(order='lex')
print "l15:",l15
output:
l15: 0
l15: l15


My question is : how can globally i will declare the value of l15?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.