Giter Site home page Giter Site logo

pymmh3's Issues

Issues in Python3.4

Hi

I was trying out pymmh3 with python3.4 and saw that on calling hash it gave me this error:

TypeError: string argument without an encoding on trying to do key = bytearray( key ) (line 30)

The fix there is to call encode() on the string before trying to call bytearray on it. I was wondering if that is the expectation for every string. It only seems to be a problem on python 3.4. Once you call encode on the string and then try it works fine.

Difference from mmh3

Hi

I was trying out pymmh3 vs mmh3 (https://pypi.python.org/pypi/mmh3/2.0) and noticed that for certain inputs the value was different.
It seems to me that pymmh3.hash returns an unsigned 32 integer vs mmh3.hash which returns a signed 32 bit integer. Is this difference intentional?

You could try with the value 'abc' and would notice that pymmh3.hash('abc') returns 3017643002 whereas mmh3.hash('abc') returns -1277324294. The 2 differ by 4294967296 (which is 2^32) and so I am assuming that for negative values some addition is being done, but just wanted to confirm.

Thanks

Weired sys line

Could you explain these two lines to me please https://github.com/wc-duck/pymmh3/blob/master/pymmh3.py#L20 + https://github.com/wc-duck/pymmh3/blob/master/pymmh3.py#L32 - what is the purpose of this?

Can't we simply use import sys and use it? Why rename and delete it?

Also in line https://github.com/wc-duck/pymmh3/blob/master/pymmh3.py#L451 sys is used although it doesn't exist.. so running it obviously give this error:

$: python3 pymmh3.py "foobar"
Traceback (most recent call last):
  File "pymmh3.py", line 451, in <module>
    sys.stdout.write( '"%s" = 0x%08X\n' % ( str_to_hash, hash( str_to_hash ) ) )
NameError: name 'sys' is not defined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.