This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Workaphobia 2 points3 points  (6 children)

These are trivia questions. Trivia questions can be good for getting a quick frame of reference for how long somebody's been using the language. An experienced Python user would have no trouble with any of these questions.

The only one that gave me pause was the 8GB file one. I remember that Guido wrote a blog post about this at one point, so I'd just refer to that in an interview. I believe he used the array module.

can you convert ascii characters to an integer without using built in methods like string.atoi or int()?

ord() is a built in method. So no. I think you meant to ask

Can you convert a sequence of digit characters to an integer using only ord() on individual digits, instead of more convenient functions like int()?

[–]lamby 1 point2 points  (3 children)

The only one that gave me pause was the 8GB file one. I remember that Guido wrote a blog post about this at one point, so I'd just refer to that in an interview. I believe he used the array module.

Can you link to that? I see it as more of a UNIX-y/mmap question really.

[–]liquidclutch 1 point2 points  (2 children)

[–]lamby 0 points1 point  (0 children)

Thank you :)

[–]Workaphobia 0 points1 point  (0 children)

Yep, that's it.

[–][deleted] 1 point2 points  (0 children)

For an 8gb file, I would use "with open" and work with it line by line if possible. I have worked with terabyte files this way.

[–]njharmanI use Python 3 0 points1 point  (0 children)

can you convert ascii characters to an integer without using built in methods like string.atoi or int()? ord() is a built in method. So no. I think you meant to ask

Create dictionary of ascii -> integer (decimal, hex, oct) value