Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use R predominantly, so forgive the lack of adequate Python-ese.

Is this behavior because numpy overloads the multiplication operation with a string as string repetition and then implicitly casts the float64 down to an integer of 3? I'm curious why this behavior manifests. When I get a chance I'll test 'xyz'*np.float(3.5)



It's "normal" in python for this to work with integers:

    >>> "x" * 3
    xxx
The only weird part (and it's not that weird IMO) is that numpy's "float" can be implicitly coerced to integer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: