tag:blogger.com,1999:blog-21332048.post1069950001663787924..comments2023-08-24T09:22:20.836-04:00Comments on Developing Upwards: Pythonic DefinedCalvin Spealmanhttp://www.blogger.com/profile/07161631946662126734noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-21332048.post-6037515035644507132012-06-08T01:59:46.963-04:002012-06-08T01:59:46.963-04:00I totally agree with Iffy. In fact I came here to...I totally agree with Iffy. In fact I came here to make exactly that comment, then noticed Iffy's comment.<br /><br />Enemy(20,100,40) is awful. what the heck are those numbers?<br /><br />Python gives you the power to write selfdocumenting code, so surely you should do that...GreenAsJadenoreply@blogger.comtag:blogger.com,1999:blog-21332048.post-40458424836147963232007-06-15T01:39:00.000-04:002007-06-15T01:39:00.000-04:00Good article. I'd make one small change to the 'e...Good article. I'd make one small change to the 'enemy' example. I'd use named parameters to clarify what the values mean, e.g: enemy = Enemy(health=100, attack=50, defense=30) which seems much more 'pythonic' -- explicit vs implicit.Iffyhttps://www.blogger.com/profile/05793151916480266440noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-62735107454020425132007-06-13T11:04:00.000-04:002007-06-13T11:04:00.000-04:00Perhaps useful in this discussion: My take on this...Perhaps useful in this discussion: <A HREF="http://faassen.n--tree.net/blog/view/weblog/2005/08/06/0" REL="nofollow">My take on this topic</A> from a few years ago.Martijn Faassenhttps://www.blogger.com/profile/11607525062261059367noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-37254875408380208622007-06-12T18:07:00.000-04:002007-06-12T18:07:00.000-04:00Marius, I don't think I would use that as a defini...Marius, I don't think I would use that as a definition of "pythonic", but it is definitely a property of a pythonic API. The difference is subtle, but important.<BR/><BR/>One could easily have an API that is memorable and doesn't ask you to read the documentation each time you come back to it, yet it could still be terribly unpythonic and wrought with other-language influences.Calvin Spealmanhttps://www.blogger.com/profile/07161631946662126734noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-50410920125032411282007-06-12T17:01:00.000-04:002007-06-12T17:01:00.000-04:00The R6RS defines it as "latent" typing (on an obje...The R6RS defines it as "latent" typing (on an object), as opposed to "manifest" typing (on a name).<BR/><BR/>Python, Scheme, Ruby: latent typing.<BR/><BR/>C, Java: manifest typing.Anonymoushttps://www.blogger.com/profile/03755383778171419021noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-54316069936602619122007-06-12T16:39:00.000-04:002007-06-12T16:39:00.000-04:00I've a pet definition of "Pythonic API": if after ...I've a pet definition of "Pythonic API": if after the first few times I can use it without having to read the documentation, then it's Pythonic. The canonical example is reading all the lines from a text file: I can do it in Python while blindfolded, but every time I have to do it in Java I have to RTFM.Marius Gedminashttps://www.blogger.com/profile/15155998626202067226noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-4241720755796516002007-06-12T16:11:00.000-04:002007-06-12T16:11:00.000-04:00To anonymous, Duck Typing is something that can be...To anonymous, Duck Typing is something that can be done in a Dynamically typed language like Perl or Python. Pythons type syste however is strongy typed and checked at runtime. Perls type syste is, shall we say, not as strongly typed and also checked at runtime.Paddy3118https://www.blogger.com/profile/06899509753521482267noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-39149078837949188312007-06-12T13:59:00.000-04:002007-06-12T13:59:00.000-04:00On the plus side, for Python 3000, it looks like s...On the plus side, for Python 3000, it looks like string1 + string2 will become <A HREF="http://mail.python.org/pipermail/python-3000/2007-January/005641.html" REL="nofollow">much faster</A>.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21332048.post-64013244800469538942007-06-12T08:45:00.000-04:002007-06-12T08:45:00.000-04:00Some people refer to it as 'Duck' typing, as in 'i...Some people refer to it as 'Duck' typing, as in 'it walks like a duck, it quacks like a duck, it must be a duck', which ends up really being 'I need it to quack, and to walk, if it can do that, it is duck enough for me'.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21332048.post-10494273025988819352007-06-12T05:27:00.000-04:002007-06-12T05:27:00.000-04:00Good entry. I also prefer the term 'dynamic typing...Good entry. I also prefer the term 'dynamic typing' to 'loose typing' though.Michael Foordhttps://www.blogger.com/profile/06229713779852499022noreply@blogger.comtag:blogger.com,1999:blog-21332048.post-55447415552740912372007-06-11T16:29:00.000-04:002007-06-11T16:29:00.000-04:00You use the term 'loose typing' for how Python han...You use the term 'loose typing' for how Python handles types. The term doesn't seem right for what Python does, and the word loose has negative connotations that don't apply to Pythons type system.<BR/>I prefer the phrase 'Python is strongly typed, with type checking occurring at run time', or simply 'strong, dynamic typed'.<BR/><BR/>I find the concept of doctest, and how it extends the use of docstrings to be eminently Pythonic.<BR/><BR/>- Paddy.Paddy3118https://www.blogger.com/profile/06899509753521482267noreply@blogger.com