mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
Merge pull request #1534 from xonsh/lazy_intersection
add __or__ to lazyobject
This commit is contained in:
commit
c92211a453
2 changed files with 17 additions and 0 deletions
13
news/lazy_union.rst
Normal file
13
news/lazy_union.rst
Normal file
|
@ -0,0 +1,13 @@
|
|||
**Added:** None
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* LazyObject supports set union
|
||||
|
||||
**Security:** None
|
|
@ -112,6 +112,10 @@ class LazyObject(object):
|
|||
obj = self._lazy_obj()
|
||||
return hash(obj)
|
||||
|
||||
def __or__(self, other):
|
||||
obj = self._lazy_obj()
|
||||
return obj | other
|
||||
|
||||
|
||||
def lazyobject(f):
|
||||
"""Decorator for constructing lazy objects from a function."""
|
||||
|
|
Loading…
Add table
Reference in a new issue