Created
December 1, 2009 18:28
-
-
Save natesilva/246511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example showing how Python default argument handling causes a bug | |
# when using the ReportLab library for Python. Tested against | |
# ReportLab 2.3. | |
# | |
# See http://gist.github.com/246507 for a generic Python example. | |
from reportlab.platypus import * | |
def main(): | |
template1 = PageTemplate(id='template1') | |
template1.frames.append(Frame(0, 0, 10, 20, id='t1_f1')) | |
template1.frames.append(Frame(30, 40, 50, 60, id='t1_f2')) | |
template2 = PageTemplate(id='template2') | |
template2.frames.append(Frame(1, 1, 11, 21, id='t2_f1')) | |
template2.frames.append(Frame(32, 42, 52, 62, id='t2_f2')) | |
# I expect to see two frames, but there are actually four. | |
# All of the frames from template1 have been copied into | |
# template2. | |
print [f.id for f in template2.frames] | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment