[Tutor] Translate this VB.NET code into Python for me?
rdm at rcblue.com
Wed Mar 5 02:58:20 CET 2008
At 10:05 AM 3/4/2008, Alan Gauld wrote:
>"Dick Moores" <rdm at rcblue.com> wrote in message
>news:20080304130635.D16391E400E at bag.python.org...
> >I thought I'd dip into .NET by downloading the free Microsoft Visual
> > Basic 2005 Express Edition, and start working through _Beginning
> > Visual Basic 2005 Express Edition_, by Peter Wright (Apress).
> > By the second chapter I've begun to suspect that GUIs aside, Python
> > is a lot simpler to write.
>It depends, there are other areas where VB is at least comparable
>to Python, especially in manipulating the Windows OS and using
>COM features etc.
> > Could someone prove that to me by translating the code I've pasted
>Jerry has done a fine job of that but it doesn't really prove much
>as he says VB has a few features that Python doesn't directly
>support (and vice versa). But also console level apps are exactly
>where Python is strong and VB weak so this kind of example
>proves that Python is better for simple OOP code using a CLI.
>You could do a GUI example and use IronPython to show how
>it copes with GUI code.
You surely don't mean that I could. :-) But could someone on the
Tutor list, the IPython-user list, or the python-win32 list? Good
idea. I'll give it a try after a bit.
>Since IP can access the same GUI
>library as VB.NET they should be very similar in code structure.
I dug up this paragraph from the new book on IPython due out in Sept. '08:
"IronPython uses .NET classes natively and seamlessly, and there are
a lot of them. Two of the gems in the collection are Windows Forms
and the Windows Presentation Foundation, which are excellent
libraries for building attractive and native looking user
interfaces. As a Python programmer, you may be surprised by how
straightforward the programmers interface
to these libraries feels. Whatever programming task you are
approaching, it is likely that there is some
.NET assembly available to tackle it. This
includes third party libraries for sophisticated GUI components,
like data grids, where there is nothing comparable available for
CPython. Table 1.1 shows a small selection of the libraries available
to you in the .NET framework."
(The last paragraph on p.12 of the the free chapter 1 in PDF form:
>I would expect VB.NET to always be at least a bit more
>verbose than Python because of its heritage, but in basic
>concepts, as your example shows, it can do pretty much the
>same kinds of things as Python (but with a much smaller
Sure does! Thanks, Alan.
More information about the Tutor