Advertisement
atm-irbis

Increment mindfuck [implementation of i = ++i + ++i]

Jul 6th, 2013
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. #!/usr/bin/env python
  2. #-*- coding: utf-8 -*-
  3.  
  4. # My implementation of
  5. #
  6. #  int i = 5;
  7. #  i = ++i + ++i;
  8. #  printf('i=%d',i);
  9. #
  10. # mindfack....
  11.  
  12. # set and increment
  13. class I:
  14.     def __init__(self,x):
  15.         self.x = x
  16.     def incr(self):
  17.         self.x += 1
  18.         return self.x
  19.  
  20. # int i = 5;
  21. i = I(5)
  22.  
  23. # i = ++i + ++i;
  24. i = i.incr() + i.incr()
  25.  
  26. # printf('i=%d',i);
  27. # // i = 13 //
  28. print i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement