Weak Type Ability for Python
Richard Damon
Richard at Damon-Family.org
Thu Apr 13 20:53:21 EDT 2023
On 4/13/23 7:25 PM, avi.e.gross at gmail.com wrote:
> s there any concept in Python of storing information in some way, such as
> text, and implementing various ideas or interfaces so that you can query if
> the contents are willing and able to be viewed in one of many other ways?
There is nothing that I know of built into Python that does this.
There is no reason you can't write your own class to implement this.
Something that by "default" looks like a string, but in some contexts
(operated on by certain types) sees if its string could be treated as a
value of some other type, and if so, converts its value to that type and
does the operation.
--
Richard Damon
More information about the Python-list
mailing list