Changes between Initial Version and Version 11 of Ticket #25509


Ignore:
Timestamp:
01/28/20 17:56:28 (21 months ago)
Author:
nailuj
Comment:

I made all the proposed adjustments. This should be ready for review.

While working on the early returns, I noticed that v = vector(R, w) and v = vector(w, R) just output w if R is equal to None or w.base_ring(). As a consequence, all changes applied to v are also applied to w. Do you think this is the desired behaviour or should a ticket be opened to ask if this might be a bug?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25509

    • Property Status changed from new to needs_review
    • Property Authors changed from to Julian Ritter
    • Property Cc gh-kliem added
    • Property Branch changed from to u/nailuj/immutable_vectors_and_matrices
    • Property Milestone changed from sage-8.3 to sage-9.1
    • Property Keywords vector matrix immutable added
    • Property Commit changed from to d4663d5b098a0dc8b919cdc9b6c93ba3d9f09aa3
  • Ticket #25509 – Description

    initial v11  
    1414}}}
    1515The aim of this ticket is to have the same for other objects, in particular vectors and matrices.
     16
     17It would avoid introducing a variable just to make this adjustment. This can simplify code by more than just one line. Consider, for example, list/set/dict comprehensions and compare
     18{{{
     19S = set()
     20for x in some_list:
     21    v = vector(x)
     22    v.set_immutable()
     23    S.add(v)
     24}}}
     25to
     26{{{
     27S = set(vector(x, immutable=True) for x in some_list)
     28}}}