Giter Site home page Giter Site logo

Comments (5)

tomvanmele avatar tomvanmele commented on August 15, 2024 1

I wonder if the pretty print should include the attribute labels or not: @tomvanmele @gonzalocasas

Point(1.678, 2.344, 5.754) or Point(x=1.678, y=2.344, y=5.754)

At the moment, even the __repr__ functions are not consistent. For example, Point.__repr__() - Has the x,y,z while Quaternion__repr__() does not.

I propose that the str() functions do not carry attribute labels unless it is not obvious; this would allow their printout to be identical to the past. Not only is it easier to read, but fewer changes to the existing docs.

the goal is to have the __repr__ be the same as the __init__, where possible. i started doing that but certainly missed quite a few...

from compas.

gonzalocasas avatar gonzalocasas commented on August 15, 2024 1

As for the proposal of not including attributes in str, I actually think the new way with attribute labels makes it more readable and despite the fact this means more updates to docs and tests in other packages, I think we should keep them.

from compas.

tomvanmele avatar tomvanmele commented on August 15, 2024

@yck011522 that would be great!

from compas.

yck011522 avatar yck011522 commented on August 15, 2024

I wonder if the pretty print should include the attribute labels or not:
@tomvanmele @gonzalocasas

Point(1.678, 2.344, 5.754) or Point(x=1.678, y=2.344, y=5.754)

At the moment, even the __repr__ functions are not consistent. For example, Point.__repr__() - Has the x,y,z while Quaternion__repr__() does not.

I propose that the str() functions do not carry attribute labels unless it is not obvious; this would allow their printout to be identical to the past. Not only is it easier to read, but fewer changes to the existing docs.

from compas.

yck011522 avatar yck011522 commented on August 15, 2024

@gonzalocasas @tomvanmele
Do we need some tests for these str methods? I ran into problems (those broken code parts) when I tested them in a console, so maybe a simple test to make sure the str() function actually runs, for example:

test___str__():
   p = Polyhedron.from_platonicsolid(12)
   str(p)

from compas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.