By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,592 Members | 1,482 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,592 IT Pros & Developers. It's quick & easy.

Re: Python 3.0 - is this true?

P: n/a
On 08Nov2008 19:17, walterbyrd <wa********@iname.comwrote:
| On Nov 8, 12:02*pm, Arnaud Delobelle <arno...@googlemail.comwrote:
| It goes well with duck typing. *It lets you know when you things happen
| that you don't mean to happen.
| But doesn't that also make the language less flexible?

No. All you need to do is define the comparison criterion so Python
doesn't make an arbitrary guess.

| For example, if I used C, I would never have to worry about assigning
| a float to an integer variable. The language will not allow it.

Hmm. I presume you've never used unions in C then?
Or cast to void* then back to another pointer?
C code can be written to pay a fair amount of attention to types
and protect (or warn, depending) about a lot of typing issues.
But you can also, either deliberately or through sloppiness,
do all sorts of nasty type mangling, including assigning a float
into space used elsewhere as an integer variable.

| I
| thought that python's flexibility, in regard to that sort of thing,
| was supposed to be one of python's great strengths.
| Would it be better if python lists only accepted one type of data?

No. That would be less flexible.

| Wouldn't that even go further to let you know when things happen, that
| you don't mean to happen?

If I meant to put different types in a list, then this would be a
serious problem.
Cameron Simpson <
Nov 9 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.