While everyone is saying what they want in Python :)

David C. Ullrich ullrich at math.okstate.edu
Tue Feb 6 16:17:05 CET 2001


On Tue, 06 Feb 2001 01:35:02 GMT, "Don Tuttle" <tuttledon at hotmail.com>
wrote:

>
>"Jay O'Connor" <joconnor at cybermesa.com> wrote in message
>news:3A7DB154.87E04245 at cybermesa.com...
>> I'm not familiar with the 'with' keyword in Delphi.
>
>Here's a vbscript example.
>With MyLabel
>   .Height = 2000
>   .Width = 2000
>   .Caption = "This is MyLabel"
>End With
>Personally, I'd love to see Python include the 'with' keyword! It improves
>readability and should execute a bit faster as well.

Delphi's "with" is more or less the same except without the
dots at the start of the field names. For a long time I've
seen Delphi people say that with is bad, the reason
being it leads to bugs

with AnObject do
  begin
    OneThing
    AnotherThing
  end

when AnObject does not have a OneThing method
but there _is_ a OneThing in the surrounding scope.

For years I thought this was just stupid - you should
know what sort of object you're dealing with. The 
Python slogans about how explicit is better than
implicit just about have me convinced that 
people are right, with is bad.

Right or not, it certainly seems contrary to the
"explciit is better than implicit" philosophy.

>Don
>
>
>
>




More information about the Python-list mailing list