Owlready
Search
everywhere
only in this topic
Advanced Search
Multiple types in domain
Classic
List
Threaded
♦
♦
Locked
3 messages
emir
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Multiple types in domain
How to set multiple domains for a property?
range = OneOf([str, int])
Python below 3.9 doesn't support str|int notation I think
Jiba
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Multiple types in domain
Administrator
Hi,
The | operator is supported between classes, but not with Python types. You can use the Or class instead:
my_data_prop.range = [ Or([int, str]) ]
Jiba
emir
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Multiple types in domain
Thank you, Jiba!
I will try
Free forum by Nabble
Edit this page