[Tutor] Quick way to find the data type
Jacob S.
keridee at jayco.net
Fri Sep 30 03:10:56 CEST 2005
I don't believe that eval() *would* work quite as intended either.
For example:
eval('a random string')
SyntaxError
and McGuire's method
othermethod('a random string')
'a random string'
Another example
eval('file')
<type 'file'>
othermethod('file')
'file'
That is, of course, if I understood the McGuire's method clearly. I didn't
look very close. It might be that McGuire's method doesn't account for the
second case either.
HTH,
Jacob
> Fair enough Danny,
> I made the changes. Thanks for the input.
>
>
> Still, regarding this comment.....
>
> On 9/27/05, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
>> The assumptions you make, about controlling the input, and being the only
>> source of the xml output, sound fine. But you're assuming that the
>> environment that your program will work in will be static. Software
>> often
>> ends up being applied in places that are ridiculous and unplanned-for,
>> like a network application. It's best practice to avoid unneccessary
>> risk, and not to court it. *grin*
>
> Well, the fact is I'm in charge of these things here, fortunately. My
> job is to make sure nothing gets used the wrong way. :-)
>
> Still, your points are valid and I have taken note of them :-)
>
> Bernard
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list