Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

changing how elements of Zmod are printed out

By default, the elements of Zmod are printed without the modulus - e.g.:

sage: a = mod(1,3)                                                                                                                                                                                                                                                            
sage: print(a)
1

so it's even hard to distinguish them from integers in the output. I want them to be always printed out like mod(1, 3) in the above example. It's not a big deal to do so for any particular element, but I'd like this be changed system-wide.

So, my question is how to re-define how elements of a particular class are printed out?

changing how elements of Zmod are printed out

By default, the elements of Zmod are printed without the modulus - e.g.:

sage: a = mod(1,3)                                                                                                                                                                                                                                                            
sage: print(a)
1

so it's even hard to distinguish them from integers in the output. I want them to be always printed out like mod(1, 3) in the above example. It's not a big deal to do so for any particular element, but I'd like this be changed system-wide.

So, my question is how to re-define how elements of a particular class are printed out?

changing how elements of Zmod an existing class are printed out

By default, the elements of Zmod are printed without the modulus - e.g.:

sage: a = mod(1,3)                                                                                                                                                                                                                                                            
sage: print(a)
1

so it's even hard to distinguish them from integers in the output. I want them to be always printed out like mod(1, 3) in the above example. It's not a big deal to do so for any particular element, but I'd like this be changed system-wide.

So, my question is how to re-define how elements of a particular class are printed out?

changing change how elements of an existing class are printed out

By default, the elements of Zmod are printed without the modulus - e.g.:

sage: a = mod(1,3)                                                                                                                                                                                                                                                            
sage: print(a)
1

so it's even hard to distinguish them from integers in the output. I want them to be always printed out like mod(1, 3) in the above example. It's not a big deal to do so for any particular element, but I'd like this be changed system-wide.

So, my question is how to re-define how elements of a particular an existing class (such as Zmod) are printed out?