xonsh / lazyasd

Lazy & self-destructive tools for speeding up module imports
http://xon.sh
BSD 3-Clause "New" or "Revised" License
52 stars 8 forks source link

String concatination fails on first use #14

Closed con-f-use closed 2 years ago

con-f-use commented 2 years ago

String concatination with a lazy object fails (e.g. STASH_USER + "test" in the example below). The exception being thrown is: TypeError: unsopported operand type(s) for +: 'LazyObject' and 'str'. See picture:

image

Here, STASH_USER is something like

from lazyasd import lazyobject

@lazyobject
def STASH_USER(): return some_expensive_function_that_returns_a_string()

I think lazyasd needs to implement an __add__ and __concat__ @gforsyth, @scopatz .