SCENE.locator1 would return an instance of a PyNode which no longer provides you with the dot-notation for grabbing children, so daisy-chining them wouldn't work.
>>> SCENE.a.b.locator1 # <-- won't work
The '|' is a bitwise operator and unless implemented will return a bitwise OR from its left- and right-hand sides.
>>> SCENE.a | b | locator1 # <-- won't work, b isn't defined and | wouldn't know what to do with it if it was
As for duplicate names.. the only possibly solution SCENE could offer you, other than throw an exception, would be to hide duplicates and only return one of the possible matches. This would lead to some unpredictable code on your end.
Why not stick with pm.PyNode('|a|b|locator1')?
To make it hide duplicates, you could do:
def SCENE(name):
single_result = (pm.ls(name) + [None])[0] return pm.PyNode(single_result) if single_result else None
>>> SCENE('locator1')
Or
SCENE = lambda name: pm.PyNode((pm.ls(name) + [None])[0])
>>> SCENE('locator1')
Or
class SCENE(object):
def __getattr__(self, name):
single_result = (pm.ls(name) + [None])[0]
return pm.PyNode(single_result) if single_result else None
>>> SCENE.locator1