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

Fix table creation race, add Python 3 compatibility, minor stuff #3

Merged

Conversation

hannes-ucsc
Copy link
Contributor

Fixes #2

Tested with Python 2.7.10 and 3.6.3

timeoutms=30 * 1000, region_name='us-west-2'):
if holder is None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default values of keyword arguments are evaluated at function definition time, not function call time. I wasn't sure what your original intention was with the holder. The way it was before all instances of this class in the same process (Python interpreter) would share the same holder unless they explicitly specified one to the constructor. I find that counter-intuitive.

import uuid
def x(x=str(uuid.uuid4())):
    return x
x()
'f8fd8b3a-28cb-4f6c-8e0a-9eb45f75ae89'
x()
'f8fd8b3a-28cb-4f6c-8e0a-9eb45f75ae89'
def y(y=None):
    return str(uuid.uuid4()) if y is None else y
y()
'ce0a0f00-cfc5-40ea-a2db-6d56b4115e33'
y()
'e7711eaf-851e-4c91-a5e7-a785942ab353'

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't consider that it would be used in the same interpreter!

@chiradeep chiradeep merged commit cdc91eb into chiradeep:master Dec 21, 2017
@chiradeep
Copy link
Owner

thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants