Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18454 > unrolled thread

Re: python philosophical question - strong vs duck typing

Started byDevin Jeanpierre <jeanpierreda@gmail.com>
First post2012-01-03 16:06 -0500
Last post2012-01-03 16:06 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python philosophical question - strong vs duck typing Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-03 16:06 -0500

#18454 — Re: python philosophical question - strong vs duck typing

FromDevin Jeanpierre <jeanpierreda@gmail.com>
Date2012-01-03 16:06 -0500
SubjectRe: python philosophical question - strong vs duck typing
Message-ID<mailman.4387.1325624829.27778.python-list@python.org>
> Python objects are strongly typed, in any sensible meaning of the term.

There are people that hold definitions of strong typing that preclude
Python. Those people think their definition is reasonable, but at the
same time haven't confused static typing with strong typing. I guess
the problem is that this boils down to opinion, but you're stating it
as incontrovertible fact.

> What you mean is statically or explicitly typing names.

Right, yes.

> Cython compiles Python as is to C. It also gives the option to add type
> annotations to names to get faster code. Shredskin compiles a subset of
> Python, or a subset of usages, to C, with similar benefits.

I seem to remember there being a project which compiled the Python
bytecode down to C in a very dumb way (basically just making C code
that creates the bytecode and executes it in the CPython VM). I can't
find it, though.

Anyway, compiling Python to C is actually fairly trivial. People
usually mean something else by it, though.

-- Devin

On Tue, Jan 3, 2012 at 3:38 PM, Terry Reedy <tjreedy@udel.edu> wrote:
> On 1/3/2012 1:13 PM, Sean Wolfe wrote:
>
>> I have a theoretical / philosophical question regarding strong vs duck
>> typing in Python. Let's say we wanted to type strongly in Python and
>
>
> Python objects are strongly typed, in any sensible meaning of the term.
> What you mean is statically or explicitly typing names.
>
>
>> were willing to compromise our code to the extent necessary, eg not
>> changing variable types or casting or whatever. Let's say there was a
>> methodology in Python to declare variable types.
>>
>> The question is, given this possibility, would this get us closer to
>> being able to compile down to a language like C or C++?
>
>
> Cython compiles Python as is to C. It also gives the option to add type
> annotations to names to get faster code. Shredskin compiles a subset of
> Python, or a subset of usages, to C, with similar benefits.
>
> --
> Terry Jan Reedy
>
> --
> http://mail.python.org/mailman/listinfo/python-list

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web