Replies: 2 comments 5 replies
-
EDIT: ... but Pydantic V2 is considerably faster (would need to benchmark this, though). |
Beta Was this translation helpful? Give feedback.
-
Thanks for raising this, @dhdaines. If there's a non-breaking, performance-stable way to do this, I'm all for it. Seems like it'd add some consistency, legibility, and rigor to an important part of the library. @julian-r had a similar suggestion earlier this year, in #816 The idea with the "legacy getter layer" @julian-r mentioned, I think, is to prevent the breakage — so that people could still call, e.g., The main question then becomes performance. |
Beta Was this translation helpful? Give feedback.
-
This is obviously a (very) breaking change, but I find myself wishing that
pdfplumber
used something like Pydantic, dataclasses or even just plain old namedtuple for the various objects it returns (.chars
,extract_words
, etc, etc).The main reason obviously is type checking - it will also help those of us in more recent British colonies who have an annoying habit of typing
stroking_colour
instead ofstroking_color
:) - but also the syntax is more concise and easier to read.namedtuple
s have a certain efficiency advantage overdict
s but I don't think this is the case for Pydantic or dataclasses.Has this been considered?
Beta Was this translation helpful? Give feedback.
All reactions