tag:blogger.com,1999:blog-1693014329567144872.post6035074769277739161..comments2023-08-27T06:49:20.658+01:00Comments on The Glowing Python: How to use reflectionJustGlowinghttp://www.blogger.com/profile/17212021288715206641noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-1693014329567144872.post-67853501030235723242014-03-05T12:35:16.073+00:002014-03-05T12:35:16.073+00:00Here is a workaround if you are using python3.3, a...Here is a workaround if you are using python3.3, as you'll most likely come to an error...<br /><br />In the print_all method, change the if validation to:<br /><br />if names[:2] != "__" and names[-2:] != "__" and names != "print_all" and callable(attr):bruno_vilhenanoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-60779355081182774482013-10-17T12:05:41.992+01:002013-10-17T12:05:41.992+01:00@JustGlowing: I suppose you don't get Anonymou...@JustGlowing: I suppose you don't get Anonymous's question<br /><br />He/ She has modified your code with the below in the first line of your code<br /><br />class Obj: <br /><br />has been changed to<br /><br />class Obj(object):<br /><br />and when this is done in your code it fails with the above mentioned error :)<br />and that is true... with the new-style class/ object there are more functions inherited, other than the one's in your class.<br />so it throws error when the reflection part of the code calls them.Raghavhttps://www.blogger.com/profile/14073733432551715775noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-23754369977253474792012-11-17T06:17:52.732+00:002012-11-17T06:17:52.732+00:00Any way to get the parameters?Any way to get the parameters?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-77634456175959635632012-05-23T18:00:17.474+01:002012-05-23T18:00:17.474+01:00I just compiled it with the same version and works...I just compiled it with the same version and works fine. Try to copy the entire snippet and to compiler without any change.JustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-8342713874509905862012-05-23T16:38:07.420+01:002012-05-23T16:38:07.420+01:00Python 2.7, I do believe.Python 2.7, I do believe.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-32228701001369895102012-05-23T14:56:08.265+01:002012-05-23T14:56:08.265+01:00which version of Python are you using?which version of Python are you using?JustGlowinghttps://www.blogger.com/profile/17212021288715206641noreply@blogger.comtag:blogger.com,1999:blog-1693014329567144872.post-82805037461069383822012-05-23T14:48:24.244+01:002012-05-23T14:48:24.244+01:00I've just started learning Python about a mont...I've just started learning Python about a month ago, however, I've noticed if you type in 'class Obj (object):' on line 1, you get an error. I've learned that creating a class with no '(object)' is an old-style class... so my question is why would there be an error if one was to create a new-style class (with '(object)' type after)?<br /><br />Btw, the error I got was "__init__() takes exactly 2 arguments (1 given)"Anonymousnoreply@blogger.com