Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code issues? #29

Open
SoniEx2 opened this issue Feb 18, 2015 · 1 comment
Open

Code issues? #29

SoniEx2 opened this issue Feb 18, 2015 · 1 comment

Comments

@SoniEx2
Copy link

SoniEx2 commented Feb 18, 2015

I'm reading this code and I'm not sure what it does... What's new_id and why does it only use the first 35 chars of the string 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'? see here

Shouldn't this use len(symbols)? 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'[0:35] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi'

Also, here why use "[n:n + 1]" when you can just use "[n]"?

@rupa
Copy link
Owner

rupa commented Feb 24, 2015

  • new_id is returning a random 4 character string. You're right, it should be using 0,61, or len(symbols - 1). I'm missing out on lots of nice ids.
  • n vs. n:n+1 also right - might be a vestige of starting with list concatenation and not changing it, or just something I didn't notice when i wrote all this ages ago.

cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants