[Zope3-dev] spelling of namespace signifiers
Shane Hathaway
shane@zope.com
Thu, 06 Jun 2002 11:24:18 -0400
Jim Fulton wrote:
> Shane Hathaway wrote:
>
>>Jim Fulton wrote:
>>
>>>Shane Hathaway wrote:
>>>
>>>>I'll express my interpretation of the above in Python:
>>>>
>>>>parts = traversed_name.split('--', 1)
>>>>if len(parts) == 2:
>>>> namespace, name = parts
>>>>else:
>>>> namespace, name = 'content', traversed_name
>>>>
>>>>Is that your interpretation?
>>>
>>>
>>>No. The part before the first -- is the namespace and the
>>>part after the first -- is the name.
>>
>>Uh, I'm pretty sure that's exactly what I said.
>
>
> No, you said that if there would more than 1 set of --s,
> then the name would be the original name and the namespace would
> be content.
As a side note, now I know not to use the split() trick too often. It's
too easy to misinterpret. "s.split('--', 1)" can only return a sequence
containing either 1 item or 2 items. So the above code works, but it's
confusing.
Shane