Opened 5 years ago
Closed 5 years ago
#20519 closed enhancement (fixed)
py3 print in the categories
Reported by:  chapoton  Owned by:  

Priority:  minor  Milestone:  sage7.2 
Component:  python3  Keywords:  
Cc:  Merged in:  
Authors:  Frédéric Chapoton  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  294d11d (Commits)  Commit:  294d11dfff99576e536541503a4be669ec14cb70 
Dependencies:  Stopgaps: 
Description
convert some more print to py3 syntax
Change History (7)
comment:1 Changed 5 years ago by
 Branch set to public/20519
 Commit set to a99a8eb04fd2d94f66b6d9abc3df8e7a7e4c8d13
 Status changed from new to needs_review
comment:2 Changed 5 years ago by
 Status changed from needs_review to needs_work
You have doctest failures because the Python3 print function is not used by the doctest framework. Also you have changed the indentation here:
@@ 1700,11 +1701,11 @@ cdef class FormalCompositeMap(Map): sage: from sage.categories.morphism import SetMorphism sage: R.<x> = QQ[] sage: def foo(x, *args, **kwds):  ... print 'foo called with', args, kwds  ... return x + ....: print('foo called with {} {}'.format(args, kwds)) + ....: return x sage: def bar(x, *args, **kwds):  ... print 'bar called with', args, kwds  ... return x + ....: print('bar called with {} {}'.format(args, kwds)) + ....: return x sage: f = SetMorphism(Hom(R, R, Rings()), foo) sage: b = SetMorphism(Hom(R, R, Rings()), bar) sage: c = b*f
You also need to remove the last ...
from here:
@@ 716,15 +717,15 @@ cdef class Map(Element): above (that was fixed in :trac:`10496`):: sage: class FOO(Map):  ... def _call_(self, x):  ... print "_call_", parent(x)  ... return self.codomain()(x)  ... def _call_with_args(self, x, args=(), kwds={}):  ... print "_call_with_args", parent(x)  ... return self.codomain()(x)^kwds.get('exponent', 1)  ... def pushforward(self, x, exponent=1):  ... print "pushforward", parent(x)  ... return self.codomain()(1/x)^exponent + ....: def _call_(self, x): + ....: print("_call_", parent(x)) + ....: return self.codomain()(x) + ....: def _call_with_args(self, x, args=(), kwds={}): + ....: print("_call_with_args", parent(x)) + ....: return self.codomain()(x)^kwds.get('exponent', 1) + ....: def pushforward(self, x, exponent=1): + ....: print("pushforward", parent(x)) + ....: return self.codomain()(1/x)^exponent ...
comment:3 Changed 5 years ago by
 Commit changed from a99a8eb04fd2d94f66b6d9abc3df8e7a7e4c8d13 to 294d11dfff99576e536541503a4be669ec14cb70
Branch pushed to git repo; I updated commit sha1. New commits:
294d11d  minor fixing in trac #20519 towards py3 print

comment:5 Changed 5 years ago by
ping ?
comment:6 Changed 5 years ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM. Thanks.
comment:7 Changed 5 years ago by
 Branch changed from public/20519 to 294d11dfff99576e536541503a4be669ec14cb70
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
New commits:
py3 print functions in the categories