Skip to content

[MNT]: Decide on a standard abbreviation for transforms when used as local variables #22156

Closed

Description

@anntzer

Summary

For local variables, I tend to like trf, but @timhoffm prefers trans (#21965 (comment)). Does anyone have an opinion as to whether we should standardize on one of them?

Proposed fix

No response

Activity

  1. jklymak commented on Jan 8, 2022

    @jklymak
    Member

    Mildly prefer trans. I'll also note that is what Agg appears to use.

  2. timhoffm commented on Jan 8, 2022

    @timhoffm
    Member

    How about trafo?

  3. pedrompecanha commented on Sep 21, 2023

    @pedrompecanha
    Contributor

    Hey guys! So, to understand it better, inside the code, there are lots of local variables that refer to transforms. There is not a pattern on how to reference this transform in the variable name. So, to solve this, one would have to dig into the code and standardize everything. Is that right?
    With that being said, I prefer trans :)

  4. story645 commented on Sep 21, 2023

    @story645
    Member

    So, to solve this, one would have to dig into the code and standardize everything. Is that right?

    Basically - the idea is that then if you search the code for the variable you'll hopefully find basically all the places in the code where a transform object is created/modified/etc.

  5. Arikad0 commented on Oct 18, 2023

    @Arikad0

    So, the objective is change the offset_transform occurences to any abreviation decided here? about the decision, I prefer trans

  6. story645 commented on Oct 19, 2023

    @story645
    Member

    So, the objective is change the offset_transform occurences to any abreviation decided here? about the decision, I prefer trans

    It's to change local internal variable names for transform objects to trans (or whichever abbreviation has consensus). For example:

    trf = transform.transform_offset()

    to

    trans = transform.transform_offset()
  7. ivanov commented on Oct 19, 2023

    @ivanov
    Member

    I read trf as tee-are-eff and it makes me go double-u-tee-eff is that? 😅

    trans is OK, and consistent with transData and transAxes, though really is transform so long? At the same time, in most places, we could even shorten it to just t or tf or trf, if necessary, as a prefix or a suffix, since the word transform is either there to get the thing when it is being assigned, or is the method called on the thing when it is being used. And yet another option would be to not assign to a variable at all, since it is rarely used more than once.

    Here's a reasonable example from the code of a Quiver method which currently reads like this:

        def get_datalim(self, transData):
            trans = self.get_transform()
            offset_trf = self.get_offset_transform()
            full_transform = (trans - transData) + (offset_trf - transData)
            XY = full_transform.transform(self.XY)

    What would you want to change this to?

    some options

        def get_datalim(self, transData):
            t = self.get_transform()
            offset_t = self.get_offset_transform()
            full_t = (t - transData) + (offset_t - transData)
            XY = full_t.transform(self.XY)
        def get_datalim(self, transData):
            trans = self.get_transform()
            transOffset = self.get_offset_transform()
            transFull = (trans - transData) + (transOffset - transData)
            XY = transFull.transform(self.XY)
        def get_datalim(self, transData):
            full_transform = (self.get_transform() - transData) + (self.get_offset_transform() - transData)
            XY = full_transform.transform(self.XY)
  8. tacaswell commented on Oct 26, 2023

    @tacaswell
    Member

    The consensus on the call is that:

    • we should prefer trans being in local variable names
    • as code is touched, it can be converted
    • we are not interested in PRs that only rename local variables
  9. timhoffm commented on Sep 15, 2025

    @timhoffm
    Member
  10. added this to the v3.8-doc milestone on Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions