bislara/code-n-stitch

Python Type Converter.

Closed this issue · 6 comments

Description

Convert a argument to the given type, this would even support type hints.
so for example you could do convert([1, 2, 3], typing.List[str]) and expect to get ["1", "2", "3"] back!

Technologies and Languages

  • python

Hey @vivax3794, congratulations!! 🎉 for creating your first issue. Wait for the admin approval now and then you can go ahead to solve the issue. Do give a star ⭐ if you like this project.

Can you explain little more, like what kind of input you will be taking from the user?

a more complex example might be:

convert(
   {"vivax": {"a": "123", "b": "456"}},
   Dict[str, Dict[str, int]]
)

output would be:

{"vivax": {"a": 123, "b": 456}}

basically traverse the data structure given and the type hint, and convert it if possible.

Okay cool. Can you please say some application for this?
I am adding projects that have some kind of application and perform certain tasks. So, I somewhat feel this is not relevant to it.

tbh you got a point, it was mainly a cool idea I had.

can't really think of a situation this would be super useful, most things can be done in a more pythonic way :/

Thank you so much for expressing such ideas. If you have anything else which is relevant to this repo then, go for it, and create an issue. It doesn't matter for me whether it is a small application or a larger one. every contribution matters for me.