[Pythonmac-SIG] NSTableView and NSOutlineView backgrounds

Ronald Oussoren oussoren at cistron.nl
Wed Oct 15 10:02:10 EDT 2003


On 15 okt 2003, at 15:40, Bob Ippolito wrote:

>
> On Wednesday, Oct 15, 2003, at 09:21 America/New_York, Bob Ippolito 
> wrote:
>
>>
>> On Wednesday, Oct 15, 2003, at 09:06 America/New_York, Jack Jansen 
>> wrote:
>>
>>>
>>> On Wednesday, October 15, 2003, at 12:35 PM, Ronald Oussoren wrote:
>>>
>>>>> I've been thinking about it. And the nice thing is that "[" cannot 
>>>>> currently
>>>>> occur as the start symbol for an expression, and I think a NAME 
>>>>> after an
>>>>> expression is also safe, so adding rules like
>>>>> 	atom: '[' test methodarg* ']'
>>>>> 	methodarg: NAME ':' test
>>>>> should work...
>>>>
>>>> I'm probably very dense, but isn't '[' the start of a list literal 
>>>> or list comprehension and therefore a valid start of an expression 
>>>> or statement?.
>>>
>>> No, it is *me* who is dense. Jack: open mouth, insert foot:-)
>>
>> Surely it would be theoretically parsable with no class between list 
>> literals or comprehensions.. you wouldn't have commas, or if you did, 
>> they would be after a colon.. and you wouldn't have the keywords 
>> "for" or "in".  It probably wouldn't fit very well into the Python 
>> parser though.
>
> no clash between list literals, I mean.
>
> Also every message would be an invalid list or list comprehension 
> because of the space between the receiver and the first component of 
> the selector.
There's also the useability of this options, code like the example 
below "feel" like lists in Python.

	foo = [app beginSheet: mySheet
			modalForWindow: self.docWindow
			modalDelegate: self
			didEndSelector: "sheetDidEnd:"
			contextInfo: None ]

Actually, this feels more like a dict than a list. It definitly does 
not shout 'methodcall' at
me.

BTW. Another option for segemented method names would be:

	foo = app( 'beginSheet:', mySheet,
			   'modalForWindow:', window,
			   ... )

This requires not changes to the language, is implementable today and 
is ugly. A possible implemenation would the methohd below to ObjC 
classes and instances:

	def __call__(self, *args):
		# Python 2.3 only, no error-checking and no varargs methods
		keys = args[::2]
		actualArgs = args[1::2]
		mname = (''.join(keys)).replace(':', '_')
		return getattr(self, mname)(*actualArgS)

The obvious change to app(beginSheet=mySheet, ...) would need changes 
to the language to preserve the order of arguments.

Ronald




More information about the Pythonmac-SIG mailing list