Allow type casting from strings to numerics#71
Allow type casting from strings to numerics#71akscram wants to merge 1 commit intomaximkulkin:masterfrom
Conversation
akscram
commented
Mar 20, 2018
Number(strict=False).load("123") == 123
|
I was thinking about this in a slightly different way: there is a use case for parsing non-string types from strings. Normally, when used with JSON, JSON parser parses strings into numbers so lollipop numeric types get numbers. However, there is a case when no pre-parser available (e.g. parsing query string parameters) so it would be nice to have a mode/types that can tolerate that. Although this is not the same as allowing either representation (as is here). What I propose is to introduce parameter like I was thinking of some kind of modifier e.g. |
|
I am wondering, as this parsing is type-specific would it make sense to implement parsing in existing classes? For example by introducing an additional class, e.g. |