Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Python vs. C#

Reply
Thread Tools

RE: Python vs. C#

 
 
Jimmy Retzlaff
Guest
Posts: n/a
 
      08-12-2003
Brandon J. Van Every () wrote:
>Ok, so Python is "more flexible" than C#. If I start doing problems

that
>require a lot of flexibility, I'll remember this about Python and

consider
>it. To date I've not been working on such problems, but that could

change.
>And C# might still prove to be "flexible enough."


You almost get it. While not many problems "require" Python's
flexibility, a large number of problems can be more effectively
addressed by leveraging that flexibility. Put another way, you can often
create better solutions in less time.

Not many of Python's individual features are unique among languages
available today, but there is an amazing synergy among Python's features
that is hard to comprehend until you've used them to solve some
non-trivial problems.

In the early days of the PC there was a similar debate over the use of
Assembly versus higher level languages like C and Pascal. Not many
problems "required" the features of those higher level languages, but
people came to understand the benefits in the vast majority of
applications (benefits like time/money, maintainability, and
reliability).

Jimmy

 
Reply With Quote
 
 
 
 
Brandon J. Van Every
Guest
Posts: n/a
 
      08-12-2003
Jimmy Retzlaff wrote:
>
> In the early days of the PC there was a similar debate over the use of
> Assembly versus higher level languages like C and Pascal. Not many
> problems "required" the features of those higher level languages, but
> people came to understand the benefits in the vast majority of
> applications (benefits like time/money, maintainability, and
> reliability).


Well, I think mainstream commercial industry sees the writing on the wall
regarding garbage collection. But that's probably the current level of
consensus on "yes, we need a better solution for this." Python advocates
tend to pooh-pooh strong typing, and I'm wondering if in a large-scale
industrial context, if that's really a valid stance to take. At any rate, I
expect more years of evolution with languages such as Java and C# before
mainstream industry starts thinking that the more exotic things Python does
are "better solutions" for something that definitely needs fixing.

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.

 
Reply With Quote
 
 
 
 
Heiko Wundram
Guest
Posts: n/a
 
      08-12-2003
On Tue, 2003-08-12 at 03:20, Brandon J. Van Every wrote:
> Well, I think mainstream commercial industry sees the writing on the wall
> regarding garbage collection. But that's probably the current level of
> consensus on "yes, we need a better solution for this." Python advocates
> tend to pooh-pooh strong typing, and I'm wondering if in a large-scale
> industrial context, if that's really a valid stance to take.


I've used Python for most of my university projects so far (at least
where I could choose what to use), and I've had professors look at me
asking why I chose "an outsider" like Python over languages (considered
to be "stronger") such as C++ and SML (whatever...).

They only asked until they had a look at the code I had produced.

Where other people had written huge amounts of C++ code for a renderer,
which was incomprehensible even to the original programmer after about a
weeks time, my code remained "relatively" short and clean (I had to
write it in 72 hours), nicely structured into separate modules, and with
a well designed class inheritance scheme (which is pretty important for
a renderer, for the user to be able to integrate his/her own objects
later on).

Metaclass programming aided me a lot here. And, yeah, I love
doc-strings!

None of my competitors could offer this, whatever language they chose
(one chose Perl, all others C++...).

None of the professors even spoke about garbage collection, none spoke
about dynamic typing, they were all just amazed at the expressive powers
Python put in my hands, all with simple syntax and a without a huge STL
(such as C++s).

I was even asked to give a Python lecture later on (not in an official
course, but for the interested).

I don't think that "static typing" (Python is strongly typed btw., just
to correct your statement) is any concern for most people (even for most
executives, I guess my professors count as that too), just getting a
working solution for a problem quickly, smoothly and readably. And
that's what Python excels at.

> At any rate, I
> expect more years of evolution with languages such as Java and C# before
> mainstream industry starts thinking that the more exotic things Python does
> are "better solutions" for something that definitely needs fixing.


Yeah, I can agree here. But in my experience, if I can show the people
what power Python comes with ("batteries included"), after their
amazement stops, they'll all start asking which book to buy to start
learning. Even with the "power-play" Sun and Microsoft did to boost Java
and C#, Python still seems as a valid and interesting alternative to
most people I know (except those living in the "Microsoft-Universe", of
course, but I guess I'll never save them from that big black hole
anyway).

Just my 5 eurocents.

Heiko.


 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      08-12-2003

"Brandon J. Van Every" <> wrote in message
news:bh9eri$vhr5i$...
> Python advocates tend to pooh-pooh strong typing,


Disinformation nonsense. Python objects are more strongly typed than
C variables. Does C# have casts?

TJR


 
Reply With Quote
 
Brandon J. Van Every
Guest
Posts: n/a
 
      08-12-2003
Heiko Wundram wrote:
>Brandon wrote:
>>
>> Python advocates tend to pooh-pooh strong typing, and I'm wondering
>> if in a large-scale industrial context, if that's really a valid
>> stance to take.

>
> Where other people had written huge amounts of C++ code for a
> renderer, which was incomprehensible even to the original programmer
> after about a weeks time, my code remained "relatively" short and
> clean (I had to
> write it in 72 hours), nicely structured into separate modules, and
> with
> a well designed class inheritance scheme (which is pretty important
> for
> a renderer, for the user to be able to integrate his/her own objects
> later on).


Yes your rendering code is nice looking. Is it fast? Were you working on a
problem where it needed to be fast? I haven't been using C++ out of love.
I've been using it for performance. And I don't think "what I can do in 72
hours" is a valid test for big industrial system architectures. Is your
code going to hold up in the face of dozens of programmers banging on it,
and hundreds or thousands of programmers using it? And still be fast?

> I don't think that "static typing" (Python is strongly typed btw.,
> just to correct your statement)


It is? Then I'm confused, because around here people keep talking about the
beauty of avoiding types.

> is any concern for most people (even for
> most executives, I guess my professors count as that too), just
> getting a
> working solution for a problem quickly, smoothly and readably. And
> that's what Python excels at.


What you are saying is Python excels at prototyping, where speed and
flexibility are paramount. You are not saying that Python excels as a big
system architecture language, where stability and safety are paramount.

> Yeah, I can agree here. But in my experience, if I can show the people
> what power Python comes with ("batteries included"), after their
> amazement stops, they'll all start asking which book to buy to start
> learning. Even with the "power-play" Sun and Microsoft did to boost
> Java
> and C#, Python still seems as a valid and interesting alternative to
> most people I know (except those living in the "Microsoft-Universe",
> of course, but I guess I'll never save them from that big black hole
> anyway).


That "except" is, like, 1/2 to 2/3 of industry. I think you Python guys
need to wake up that there's a much bigger, scarier, and more threatening
world out there than the UNIX world of "engineering done right." That world
is also not sitting still, it's on the move. For interoperability of
langauges, UNIX has nothing to offer like the .NET Framework. DirectX is
now ahead of OpenGL on vertex/pixel shader API capability and stability.
The black hole, if not taken seriously, will swallow you. Either that or
you're forced into "clone and conquer" in reverse.

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.

 
Reply With Quote
 
Joe Cheng
Guest
Posts: n/a
 
      08-12-2003
> > I don't think that "static typing" (Python is strongly typed btw.,
> > just to correct your statement)

>
> It is? Then I'm confused, because around here people keep talking about

the
> beauty of avoiding types.


Python is "strongly" typed in the sense that every object has a type. It is
not "statically" typed in that references do not have types. Statically
typed languages generally require you to declare variable types (some
languages infer them) and in return you get compile-time warnings when you
try to call methods that do not exist or perform casts that are semantically
impossible.

I may be wrong but I believe C is an example of a language with static weak
typing... you have to declare variable types and some types of errors can be
caught at compile time, but you can perform unsafe casts and not only will
the compiler not stop you but at runtime you won't get an exception--just a
possibly corrupted value in memory.

Java and C# have static strong typing.

Python has dynamic strong typing. So, if you can keep the types of your
objects straight without the help of the compiler, you get the benefits of a
concise syntax while enjoying type safety at runtime.

Someone correct me if I've gotten it wrong...


 
Reply With Quote
 
John
Guest
Posts: n/a
 
      08-12-2003
> I've used Python for most of my university projects so far (at least
> where I could choose what to use), and I've had professors look at me
> asking why I chose "an outsider" like Python over languages (considered
> to be "stronger") such as C++ and SML (whatever...).


> They only asked until they had a look at the code I had produced.


Likewise. And I actually succeeded in getting several people
interested. I love Python. But I love C# just as much and it is hard
to say which one I love better.

No too long ago, I had to create a tool for an information retrieval
project. I needed RegEx, GUI, Containers and Database features. And I
needed to make this fast. First I looked at Delphi. It had by far the
BEST GUI framework. Nothing else even comes close for GUI RAD. In most
cases, I just need to go a web site like www.torry.net and simply pick
from a choice of open source components. BUT it did not have RegEx.
Sure there was a lib or 2 out there but nothing standard. Same story
with containers.

Then I started with Python. Python had everything I needed. But my app
was GUI rich and it was taking too long to layout the interface. Even
with Boa Contructor, it still was taking a while. I had already
finished writing most of the classes for the app.

I switched to C#. Surprise. It took me hardly any time to port the
Python code to it. For everything I needed from Python, I had direct
analogues in C# (at least in the context of my app). And I finally
wrapped everything up quite quickly. I enjoyed C# as much I enjoyed
Python. Of course, the user was quite dismayed when I told him about
the 28 MB of dependencies. But the software did exactly what it was
expected to.

As for static typing, that never slows me down. What makes C++ slower
to program in not declaring types. It's the memory details to watch,
complex developmental cycles (not just compile time), lack of quick
libraries (batteries included) that we get with languages like Perl
and Python etc.

What enhanced my C# experience has a lot to do with mature tools than
with the language per se. The VS2003 IDE is far more complete than
PythonWin and Boa. Code Completion, Help integration for example is
far more mature and often means I rarely have to refer to the docs.

The standard library is fantastic as well. MS finally made a
developmental tool that is hard to point fingers at.

Personally I would like to see Python in a .NET environment. Not some
silly IDE add-in like Visual Python. One comment in this thread was
that Python's dynamic typing makes it difficult to port it to .NET.
But Perl is dynamically typed too. And ActiveState has a feasible .NET
language with Perl. What gives for Python? I don't know much about the
language internals but I believe true integration of Python into VS
will do it a world of good.

Adding onto "what C# can do that Python can't?", I am now developing
an app for the PocketPC with the Compact Framework in C#. The app is
every bit as professional as an experienced programmer might have
developed with eVC. And I was able to do it in a fraction of time of
it might have taken with C++ and MFC and this is my FIRST PocketPC
app. Python cannot do that at this point of time.

Similarly ASP.NET like development experience is hard to get from
Python at this point. Yes! There are several webapp frameworks for
Python and then there is Zope. But ASP.NET is something else and suits
certain kind of web apps quite well (Though Zope is way to go for
CMS). I am sure Python community will catch up eventually to this
paradigm but for now it doesn't.
 
Reply With Quote
 
Duncan Booth
Guest
Posts: n/a
 
      08-12-2003
"Joe Cheng" <> wrote in
news:Jq%Za.8237$ link.net:

> Java and C# have static strong typing.
>
> Python has dynamic strong typing. So, if you can keep the types of
> your objects straight without the help of the compiler, you get the
> benefits of a concise syntax while enjoying type safety at runtime.
>
> Someone correct me if I've gotten it wrong...
>

You have it about right. C# lets you define functions that take arguments
of any type by boxing them as objects. However, to perform almost any
operation on these values you have to cast them back to their original
type. So a function that takes two objects and adds them together can't
work unless you know the type you expected the objects to be. You cannot
just add two objects, even if they are of the same type, you have to cast
(unbox) them from object back to their real type (and you have to get that
type *exactly* right, you can't for example unbox a short as an int) and
then operate on them.

[A couple of operations work directly on objects, you can convert any
object to a string, and compare objects for equality directly].

Python on the other hand will let you do something like adding two objects
together, it will perform some permitted conversions automatically, e.g.
extending int to float, but it won't attempt to do weird things like parse
a string into a number, or for that matter automatically convert a number
to a string.

Both languages are strongly typed. The drawback with C# is mainly that you
have to keep telling the language things that both you and the compiler
already know. If I have an ArrayList filled with strings, and I want to
pass one of them to a function taking a string argument, I have to
explicitly cast the element of the ArrayList back to string. If the cast
fails at runtime I get an exception. Why can the compiler not put that cast
in silently and give me the same exception at runtime?

--
Duncan Booth
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
 
Reply With Quote
 
Brandon J. Van Every
Guest
Posts: n/a
 
      08-12-2003
Joe Cheng wrote:
>
> Python has dynamic strong typing. So, if you can keep the types of
> your objects straight without the help of the compiler, you get the
> benefits of a concise syntax while enjoying type safety at runtime.


And how, in a large scale industrial systems context, are you supposed to
ensure that Joe Programmer doesn't in fact screw it up?

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.

 
Reply With Quote
 
Aahz
Guest
Posts: n/a
 
      08-12-2003
In article <54nm01->,
Theodor Rash <> wrote:
>
> --------------------------
> /| /| | |
> ||__|| | Please don't |
> / O O\__ feed |
> / \ the trolls |
> / \ \ |
> / _ \ \ ----------------------
> / |\____\ \ ||
> / | | | |\____/ ||
> / \|_|_|/ | __||
> / / \ |____| ||
> / | | /| | --|
> | | |// |____ --|
> * _ | |_|_|_| | \-/
> *-- _--\ _ \ // |
> / _ \\ _ // | /
> * / \_ /- | - | |
> * ___ c_c_c_C/ \C_c_c_c____________


ROTFL!

Now, if you wanna make one *really* funny, make it with a panda.
--
Aahz () <*> http://www.pythoncraft.com/

Let's see who gets this reference
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 R. David Murray Python 0 01-17-2011 02:23 PM
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 Senthil Kumaran Python 0 01-17-2011 10:31 AM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Martin v. Löwis Python 0 03-01-2008 10:51 PM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Paul Moore Python 0 03-01-2008 10:39 PM
Searching comp.lang.python/python-list@python.org (was: UTF-8) skip@pobox.com Python 0 03-10-2007 02:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57