Re:Use JSON files as if they are Python modules
by jzelinskie on Sunday January 24, 2016 @09:20PM
(#10965231)
Likely for the fun and it might just save time when writing one off scripts or using the interpreter.
I nearly spit my drink out at the name, though.
Re:Use JSON files as if they are Python modules
by kragniz on Sunday January 24, 2016 @10:20PM
(#10965377)
Yes, it was just for fun.
Re:Use JSON files as if they are Python modules
by karolmajta on Monday January 25, 2016 @08:47AM
(#10967102)
Fun is the only thing that can justify this blasphemy :)
Why do this instead of:
myvar = read_json_file_as_object('path/to/file')
??Ok, you can argue that function would hit the hard drive many times when called from multiple modules (while imports would not), but this can be fixed with simple memoization.
I'm curious why the author would do this. Just for the fun in it?