Giter Site home page Giter Site logo

__repr__ recursion about pydantic HOT 4 CLOSED

sushart avatar sushart commented on June 15, 2024
__repr__ recursion

from pydantic.

Comments (4)

sydney-runkle avatar sydney-runkle commented on June 15, 2024 1

@sushart,

Hmm, nice find. Definitely a bug. Seems relatively low stakes, so will leave this as a good first issue for anyone interested!

from pydantic.

eugenetriguba avatar eugenetriguba commented on June 15, 2024

@sushart In this example, I'm curious what the output you're expecting is? The reason I ask is because the model has a cycle. The parent of gf_ref is set to the root object and so when gf_ref is attempted to be serialized, it attempts to serialize the root object again and then it attempts to serialize gf_ref again and so on.

@sydney-runkle Is an error here not the appropriate response? How were you thinking these cycles should be handled differently?

from pydantic.

sushart avatar sushart commented on June 15, 2024

@eugenetriguba I would expect that I can chose which elements are involved in the compare process or if done automatically recursion is recognised and interrupted. Like repr=False compare=False wouldn't it be a nice and worthy feature?

from pydantic.

sydney-runkle avatar sydney-runkle commented on June 15, 2024

@eugenetriguba,

Thanks for the questions - on second thought, I do think this is the expected behavior. Marking as resolved for now!

from pydantic.

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.