Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Tkinter callback arguments

 

 

First page Previous page 1 2 Next page Last page  View All Python python RSS feed   Index | Next | Previous | View Threaded


alfps at start

Nov 3, 2009, 11:50 PM

Post #26 of 35 (335 views)
Permalink
Re: Tkinter callback arguments [In reply to]

* Gabriel Genellina:
>
> I don't understand either. R1 and R2 have *different* semantics.

Assume that they have the very exact same semantics -- like two TV sets that
look the same and work the same except when you open 'em up and poke around in
there, oh holy cow, in this one there's stuff that isn't in the other.

After all the semantics (like the TV controls and their effects) were left
unspecified, only the internal representations (like, the main circuit boards
*inside* the TVs) were described, and the example only makes sense if R1 and R2
have the same semantics, that is, work the same via their public interfaces.

If I'd known that people would start a discussion based on their wishes that the
unspecied semantics should be some that made the example meaningless, well, then
I'd simply specified the semantics -- consider that done.


> They don't behave the same.

Assume that they do -- except when you go poking into the innards.


Cheers & hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list


gagsl-py2 at yahoo

Nov 4, 2009, 1:38 AM

Post #27 of 35 (329 views)
Permalink
Re: Tkinter callback arguments [In reply to]

En Wed, 04 Nov 2009 04:50:42 -0300, Alf P. Steinbach <alfps [at] start>
escribió:

> * Gabriel Genellina:
>> I don't understand either. R1 and R2 have *different* semantics.
>
> Assume that they have the very exact same semantics -- like two TV
> sets that look the same and work the same except when you open 'em up
> and poke around in there, oh holy cow, in this one there's stuff that
> isn't in the other.

>
>> They don't behave the same.
>
> Assume that they do -- except when you go poking into the innards.

And the problem is...?
That the internal details are different? Who cares?
(I'm lost now.)

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list


alfps at start

Nov 4, 2009, 1:45 AM

Post #28 of 35 (326 views)
Permalink
Re: Tkinter callback arguments [In reply to]

* Gabriel Genellina:
> En Wed, 04 Nov 2009 04:50:42 -0300, Alf P. Steinbach <alfps [at] start>
> escribió:
>
>> * Gabriel Genellina:
>>> I don't understand either. R1 and R2 have *different* semantics.
>>
>> Assume that they have the very exact same semantics -- like two TV
>> sets that look the same and work the same except when you open 'em up
>> and poke around in there, oh holy cow, in this one there's stuff that
>> isn't in the other.
>
>>
>>> They don't behave the same.
>>
>> Assume that they do -- except when you go poking into the innards.
>
> And the problem is...?
> That the internal details are different? Who cares?
> (I'm lost now.)

It's a common Usenet phenomenon: the warping thread.

Context is lost.

It is available by going back up-thread but at the cost of some work. :-)


Cheers & hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list


tjreedy at udel

Nov 4, 2009, 10:46 AM

Post #29 of 35 (323 views)
Permalink
Re: Tkinter callback arguments [In reply to]

Alf P. Steinbach wrote:

> However, the natural semantics is that various logical properties, such
> as left, top, right, bottom, width and height, can be varied independently.

But they *CANNOT* be varied independently. A rectangle with side
parallel to the axes has exactly 4 degress of freedom, not 6.

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


alfps at start

Nov 4, 2009, 1:08 PM

Post #30 of 35 (322 views)
Permalink
Re: Tkinter callback arguments [In reply to]

* Terry Reedy:
> Alf P. Steinbach wrote:
>
>> However, the natural semantics is that various logical properties,
>> such as left, top, right, bottom, width and height, can be varied
>> independently.
>
> But they *CANNOT* be varied independently. A rectangle with side
> parallel to the axes has exactly 4 degress of freedom, not 6.

Yes <g>. That's the basic idea of the example I presented up-thread, that's
discussed here. With R1's state variables width and heigh can be varied
independently by direct modification, with R2 it's right and bottom.

The public interface must also make this choice, but it's an independent choice:
the internal rectangle representation can have the opposite choice.

And conversely, that means that if the internal representation isn't used
directly, then it can be changed without affecting the public interface.


Cheers,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list


steven at REMOVE

Nov 4, 2009, 4:39 PM

Post #31 of 35 (323 views)
Permalink
Re: Tkinter callback arguments [In reply to]

On Wed, 04 Nov 2009 08:50:42 +0100, Alf P. Steinbach wrote:

> * Gabriel Genellina:
>>
>> I don't understand either. R1 and R2 have *different* semantics.
>
> Assume that they have the very exact same semantics


Why would we assume that when you have explicitly told us that they don't?

You stated categorically that they behave differently when you assign to
the attribute/property "top". According to your own description, setting
R1.top moves the rectangle, while setting R2.top resizes it. Perhaps the
difference between "move" and "resize" is too subtle for you, but you can
trust us on this, they are different semantics.


> -- like two TV
> sets that look the same and work the same except when you open 'em up
> and poke around in there, oh holy cow, in this one there's stuff that
> isn't in the other.


Whether "top" is an attribute or a property is irrelevant, it is still
part of the public API of the class. Such public attributes are NOT
private internal details, they are part of the public interface. You've
been told this repeatedly. Perhaps one more time may help:

Public attributes are public.



--
Steven
--
http://mail.python.org/mailman/listinfo/python-list


alfps at start

Nov 4, 2009, 5:48 PM

Post #32 of 35 (313 views)
Permalink
Re: Tkinter callback arguments [In reply to]

* Steven D'Aprano:
> On Wed, 04 Nov 2009 08:50:42 +0100, Alf P. Steinbach wrote:
>
>> * Gabriel Genellina:
>>> I don't understand either. R1 and R2 have *different* semantics.
>> Assume that they have the very exact same semantics
>
>
> Why would we assume that when you have explicitly told us that they don't?
>
> You stated categorically that they behave differently when you assign to
> the attribute/property "top".

Uh, severe reading difficulties ... referring to self in plural ... Hm. :-)

But anyway, in the example description I wrote

"With R1 direct changes of left and top keeps the rectangle's size"

and this is in the context of a discussion of modifying data attributes directly
versus using properties.

Anyway, if that formulation was confusing I have clarified it later, so you
really, ideally, should have no problem grasping this.


> According to your own description, setting
> R1.top moves the rectangle, while setting R2.top resizes it. Perhaps the
> difference between "move" and "resize" is too subtle for you, but you can
> trust us on this, they are different semantics.

No, I would absolutely not trust you Steven, whether that's plural or singular,
to assign semantics to my examples.


>> -- like two TV
>> sets that look the same and work the same except when you open 'em up
>> and poke around in there, oh holy cow, in this one there's stuff that
>> isn't in the other.
>
>
> Whether "top" is an attribute or a property is irrelevant,

Sorry, that's incorrect.

For example, if it is a read only property than you can't assign to the property.

For another example, if it is a read/write property than it can update any parts
of the rectangle represention.


> it is still
> part of the public API of the class.

Sorry, that's incorrect; it depends on the class.


> Such public attributes are NOT
> private internal details, they are part of the public interface.

Sorry, that's incorrect; it depends on the class, and as far as I know and have
been informed here there are no private attributes in Python, just a notational
convention.


> You've
> been told this repeatedly.

Sorry, but repeating what you want me to have meant in my example, contrary to
the direct text of the example, contrary to its context, choosing a meaningless
interpreteration of what's left when you have ignored the text, plus contrary to
further clarifications, well that's daft to say the least.


> Perhaps one more time may help:
>
> Public attributes are public.

It would be nice if Python had private ones, yes.


Cheers & hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list


alfps at start

Nov 4, 2009, 6:55 PM

Post #33 of 35 (324 views)
Permalink
Re: Tkinter callback arguments [In reply to]

* Alf P. Steinbach:
> * Steven D'Aprano:
>> On Wed, 04 Nov 2009 08:50:42 +0100, Alf P. Steinbach wrote:
>>
>>> * Gabriel Genellina:
>>>> I don't understand either. R1 and R2 have *different* semantics.
>>> Assume that they have the very exact same semantics
>>
>>
>> Why would we assume that when you have explicitly told us that they
>> don't?
>>
>> You stated categorically that they behave differently when you assign
>> to the attribute/property "top".
>
> Uh, severe reading difficulties ... referring to self in plural ... Hm. :-)
>
> But anyway, in the example description I wrote
>
> "With R1 direct changes of left and top keeps the rectangle's size"
>
> and this is in the context of a discussion of modifying data attributes
> directly versus using properties.

Perhaps this makes it more clear: in R1, which has a width/height based
rectangle representation, assigning directly to the top data attribute
/effectively/ moves the rectangle vertically without changing its height, since
the height attribute is unchanged.

But that does not reflect any intended semantics, it's not a requirement; it's
an implementation artifact, a behavior that just results from direct
modification and the choice of a particular rectangle representation.

Real world Python example of that kind of artifact: as discussed in some other
thread here, doing open( ..., 'r+' ) followed by write followed directly by read
will on some implementations/systems produce garbage. Presumably because those
implementations use C "FILE*" to implement the functionality, and implements it
by a fairly direct mapping of calls down to the C level, where this sequence is
in general Undefined Behavior. You might regard it as semantics, and it's quite
real and presumably in a sense well-defined for the particular implementation on
the particular system, but it's not part of any intended semantics, and any who
relies on that behavior is doing it at other's risk.

For the R1 class the indended semantics, the specification that the programmer
was handed down or produced or had in mind, might include just rectangle
construction, checking intersection with other rectangle, and obtaining any of
three pairs of values: left upper corner, right lower corner and width+height.

For example. :-)


Cheers & hth.,

- Alf
--
http://mail.python.org/mailman/listinfo/python-list


gagsl-py2 at yahoo

Nov 4, 2009, 11:34 PM

Post #34 of 35 (315 views)
Permalink
Re: Tkinter callback arguments [In reply to]

En Wed, 04 Nov 2009 18:08:49 -0300, Alf P. Steinbach <alfps [at] start>
escribió:
> * Terry Reedy:
>> Alf P. Steinbach wrote:
>>
>>> However, the natural semantics is that various logical properties,
>>> such as left, top, right, bottom, width and height, can be varied
>>> independently.
>> But they *CANNOT* be varied independently. A rectangle with side
>> parallel to the axes has exactly 4 degress of freedom, not 6.
>
> Yes <g>. That's the basic idea of the example I presented up-thread,
> that's discussed here. With R1's state variables width and heigh can be
> varied independently by direct modification, with R2 it's right and
> bottom.
>
> The public interface must also make this choice, but it's an independent
> choice: the internal rectangle representation can have the opposite
> choice.
>
> And conversely, that means that if the internal representation isn't
> used directly, then it can be changed without affecting the public
> interface.

And that's exactly what everyone is saying - so we all agree then!

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list


alfps at start

Nov 5, 2009, 1:04 AM

Post #35 of 35 (320 views)
Permalink
Re: Tkinter callback arguments [In reply to]

* Gabriel Genellina:
> En Wed, 04 Nov 2009 18:08:49 -0300, Alf P. Steinbach <alfps [at] start>
> escribió:
>> * Terry Reedy:
>>> Alf P. Steinbach wrote:
>>>
>>>> However, the natural semantics is that various logical properties,
>>>> such as left, top, right, bottom, width and height, can be varied
>>>> independently.
>>> But they *CANNOT* be varied independently. A rectangle with side
>>> parallel to the axes has exactly 4 degress of freedom, not 6.
>>
>> Yes <g>. That's the basic idea of the example I presented up-thread,
>> that's discussed here. With R1's state variables width and heigh can
>> be varied independently by direct modification, with R2 it's right and
>> bottom.
>>
>> The public interface must also make this choice, but it's an
>> independent choice: the internal rectangle representation can have the
>> opposite choice.
>>
>> And conversely, that means that if the internal representation isn't
>> used directly, then it can be changed without affecting the public
>> interface.
>
> And that's exactly what everyone is saying - so we all agree then!

Well, it may be that we *violently* agree. :-)

Cheers,

- Alf


--
http://mail.python.org/mailman/listinfo/python-list

First page Previous page 1 2 Next page Last page  View All Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.