File tree Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
3
+ from __future__ import print_function
3
4
"""http://code.activestate.com/recipes/131499-observer-pattern/"""
4
5
5
6
@@ -67,20 +68,20 @@ def main():
67
68
data2 .attach (view2 )
68
69
data2 .attach (view1 )
69
70
70
- print ("Setting Data 1 = 10" )
71
+ print (u "Setting Data 1 = 10" )
71
72
data1 .data = 10
72
- print ("Setting Data 2 = 15" )
73
+ print (u "Setting Data 2 = 15" )
73
74
data2 .data = 15
74
- print ("Setting Data 1 = 3" )
75
+ print (u "Setting Data 1 = 3" )
75
76
data1 .data = 3
76
- print ("Setting Data 2 = 5" )
77
+ print (u "Setting Data 2 = 5" )
77
78
data2 .data = 5
78
- print ("Detach HexViewer from data1 and data2." )
79
+ print (u "Detach HexViewer from data1 and data2." )
79
80
data1 .detach (view2 )
80
81
data2 .detach (view2 )
81
- print ("Setting Data 1 = 10" )
82
+ print (u "Setting Data 1 = 10" )
82
83
data1 .data = 10
83
- print ("Setting Data 2 = 15" )
84
+ print (u "Setting Data 2 = 15" )
84
85
data2 .data = 15
85
86
86
87
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def scan(self):
15
15
self .pos += 1
16
16
if self .pos == len (self .stations ):
17
17
self .pos = 0
18
- print ("Scanning... Station is" , self .stations [self .pos ], self .name )
18
+ print (u "Scanning... Station is" , self .stations [self .pos ], self .name )
19
19
20
20
21
21
class AmState (State ):
@@ -27,7 +27,7 @@ def __init__(self, radio):
27
27
self .name = "AM"
28
28
29
29
def toggle_amfm (self ):
30
- print ("Switching to FM" )
30
+ print (u "Switching to FM" )
31
31
self .radio .state = self .radio .fmstate
32
32
33
33
@@ -40,7 +40,7 @@ def __init__(self, radio):
40
40
self .name = "FM"
41
41
42
42
def toggle_amfm (self ):
43
- print ("Switching to AM" )
43
+ print (u "Switching to AM" )
44
44
self .radio .state = self .radio .amstate
45
45
46
46
Original file line number Diff line number Diff line change 19
19
https://github.com/pallets/werkzeug/blob/5a2bf35441006d832ab1ed5a31963cbc366c99ac/werkzeug/utils.py#L35
20
20
"""
21
21
22
-
22
+ from __future__ import print_function
23
23
import functools
24
24
25
25
@@ -52,11 +52,11 @@ def relatives(self):
52
52
53
53
def main ():
54
54
Jhon = Person ('Jhon' , 'Coder' )
55
- print ("Name: {0} Occupation: {1}" .format (Jhon .name , Jhon .occupation ))
56
- print ("Before we access `relatives`:" )
55
+ print (u "Name: {0} Occupation: {1}" .format (Jhon .name , Jhon .occupation ))
56
+ print (u "Before we access `relatives`:" )
57
57
print (Jhon .__dict__ )
58
- print ("Jhon's relatives: {0}" .format (Jhon .relatives ))
59
- print ("After we've accessed `relatives`:" )
58
+ print (u "Jhon's relatives: {0}" .format (Jhon .relatives ))
59
+ print (u "After we've accessed `relatives`:" )
60
60
print (Jhon .__dict__ )
61
61
62
62
You can’t perform that action at this time.
0 commit comments