tag:blogger.com,1999:blog-684183198890094283.post7224072269345262121..comments2023-11-05T06:12:59.718-05:00Comments on S.Lott-Software Architect: Intuition and ExperienceS.Lotthttp://www.blogger.com/profile/06337323642834330176noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-684183198890094283.post-66750303697038448632010-12-13T05:13:22.345-05:002010-12-13T05:13:22.345-05:00Life is a journey
What you have gone through can h...Life is a journey<br />What you have gone through can help others<br />Please share<br /><br />http://wikijourney.orgUnknownhttps://www.blogger.com/profile/00083539854667331128noreply@blogger.comtag:blogger.com,1999:blog-684183198890094283.post-49194146968638699562010-12-08T07:25:31.723-05:002010-12-08T07:25:31.723-05:00For a simple example, something like the following...For a simple example, something like the following might be helpful<br /><br />>>> x = 3<br />>>> print x, type(x)<br />3 <br />>>> x = float(x)<br />>>> print x, type(x)<br />3.0Robert Lucentehttps://www.blogger.com/profile/12434992671749777590noreply@blogger.comtag:blogger.com,1999:blog-684183198890094283.post-67209279837024863232010-12-07T23:05:24.537-05:002010-12-07T23:05:24.537-05:00You could have a section aimed at disentangling th...You could have a section aimed at disentangling the three technical terms, as they all refer to very similar concepts of "changing the type" of something. In C++ and Java casting is a way of changing the <i>static</i> type to make the compiler happy, but (as noted above) this is irrelevant to dynamically typed languages. Coercion in Python is a process wherein the types of some values are implicitly changed to match the requirements of an operator. Conversion is an <i>explicit</i> change of type allowing the programmer to make use of different representations of a value (string, numeric, boolean) for different purposes.<br /><br />I bet programmers interchange these three terms when speaking casually, which adds to the confusion. :PAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-684183198890094283.post-2578224213894340822010-12-07T21:08:25.945-05:002010-12-07T21:08:25.945-05:00"not sure how to word it more strongly or cle..."not sure how to word it more strongly or clearly"<br /><br />Try something like this<br /><br />"Since the concept of a declared type of a variable does not exist in Python, "casting" an object to match the variable data type is non-sensical. You don't use C++ or Java style casting in Python. This is a long winded way of saying that Python is a dynamnic language but C++ and Java are not. Also, this is one of the areas where experience with one langauge may be incorrectly and inappropriately applied to another language."<br /><br />Another possbility is that perhaps you are dealing with a poor student.Robert Lucentehttps://www.blogger.com/profile/12434992671749777590noreply@blogger.comtag:blogger.com,1999:blog-684183198890094283.post-66891292300387646972010-12-07T11:13:53.397-05:002010-12-07T11:13:53.397-05:00Well, cast and conversion don't seem so differ...Well, cast and conversion don't seem so different in meaning.<br /><br />As an example, if you have a class that implements __contains__ and it returns a non-boolean object then it will be changed to a bool. Is this a cast or a conversion?<br /><br />I guess the problem is, as you say, when people take words with a precise semantic meaning in one language and apply them to another language where that specific meaning only partly makes sense (or is only part of the story).Michael Foordhttps://www.blogger.com/profile/06229713779852499022noreply@blogger.com