[ 
https://issues.apache.org/jira/browse/TINKERPOP-2199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16831211#comment-16831211
 ] 

stephen mallette commented on TINKERPOP-2199:
---------------------------------------------

The workaround for this issue is to pass the arguments as a collection, thus 
{{P.within(["nephew","uncle","cousin"])}} - that should work. Upon digging 
deeper into the actual issue I was reminded that we were never really sure how 
to make this consistent but for some reason it dawned on me that it wasn't a 
big deal:

https://github.com/apache/tinkerpop/commit/7abc8b8ffb0a9a9a4a40b079fb10b3dd978be872

That change makes Python behave the same way that Java does in dealing with 
{{P.within()}} and {{P.without()}} - I'd expect it to be a non-breaking change 
too I guess, because most people who have run into this would be using the 
collection workaround i mentioned prior and that will have the same behavior 
before and after the change.

A pull request will be forthcoming but noticed weirdness in the other GLVs 
around this that should probably get resolved. Unsure if I'll do it as part of 
this issue or not as of right now.

> within step does not work with more than two parameters with python
> -------------------------------------------------------------------
>
>                 Key: TINKERPOP-2199
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2199
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 3.4.1
>         Environment: Linux
>            Reporter: Nicolas Gruel
>            Priority: Minor
>
> When there are more than two elements in 'within', the query return an 
> TypeError. The same query is working as expected with gremlin console:
>  
> > g.E().hasLabel(within('nephew', 'uncle', 'cousin')).drop().toList()
>  
> Gave the error:
> {color:#e75c58}---------------------------------------------------------------------------{color}
> {color:#e75c58}TypeError{color} Traceback (most recent call last)
> {color:#00a250}<ipython-input-63-074429099c0c>{color} in 
> {color:#60c6c8}<module>{color} {color:#00a250}----> {color}
> {color:#00a250}1{color} 
> g{color:#208ffb}.{color}E{color:#208ffb}({color}{color:#208ffb}){color}{color:#208ffb}.{color}hasLabel{color:#208ffb}({color}within{color:#208ffb}({color}{color:#208ffb}'nepheu'{color}{color:#208ffb},{color}
>  {color:#208ffb}'uncle'{color}{color:#208ffb},{color} 
> {color:#208ffb}'cousin'{color}{color:#208ffb}){color}{color:#208ffb}){color}{color:#208ffb}.{color}drop{color:#208ffb}({color}{color:#208ffb}){color}{color:#208ffb}.{color}toList{color:#208ffb}({color}{color:#208ffb}){color}{color:#e75c58}
> {color}
> {color:#007427} 2{color} 
> {color:#e75c58}#g.E().hasLabel('neveu').drop().toList(){color}
> {color:#007427} 3{color} 
> {color:#e75c58}#g.E().hasLabel('oncle').drop().toList(){color}
> {color:#007427}4{color} 
> {color:#e75c58}#g.E().hasLabel('cousin').drop().toList(){color}
>  
> {color:#00a250}~/.local/lib/python3.7/site-packages/gremlin_python/process/traversal.py{color}
>  in {color:#60c6c8}within{color}{color:#208ffb}(*args){color}
> {color:#007427}316{color}
> {color:#007427}317{color} {color:#00a250}def{color} 
> within{color:#208ffb}({color}{color:#208ffb}*{color}args{color:#208ffb}){color}{color:#208ffb}:{color}
>  {color:#00a250}--> {color}
> {color:#00a250}318{color}     {color:#00a250}return{color} 
> P{color:#208ffb}.{color}within{color:#208ffb}({color}{color:#208ffb}*{color}args{color:#208ffb}){color}
> {color:#007427} 319{color} 
> statics{color:#208ffb}.{color}add_static{color:#208ffb}({color}{color:#208ffb}'within'{color}{color:#208ffb},{color}within{color:#208ffb}){color}
> {color:#007427}320{color} 
> {color:#00a250}~/.local/lib/python3.7/site-packages/gremlin_python/process/traversal.py{color}
>  in {color:#60c6c8}within{color}{color:#208ffb}(*args){color}
> {color:#007427} 253{color} {color:#208ffb}@{color}staticmethod 
> {color:#007427}254{color} {color:#00a250}def{color} 
> within{color:#208ffb}({color}{color:#208ffb}*{color}args{color:#208ffb}){color}{color:#208ffb}:{color}
>  {color:#00a250}-->{color}
> {color:#00a250} 255{color}      {color:#00a250}return{color} 
> P{color:#208ffb}({color}{color:#208ffb}"within"{color}{color:#208ffb},{color} 
> {color:#208ffb}*{color}args{color:#208ffb}){color}
> {color:#007427} 256{color}
> {color:#007427} 257{color} {color:#208ffb}@{color}staticmethod
>  
> {color:#e75c58}TypeError{color}: __init__() takes from 3 to 4 positional 
> arguments but 5 were given
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to