File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
3+ from __future__ import print_function
34"""http://code.activestate.com/recipes/131499-observer-pattern/"""
45
56
@@ -67,20 +68,20 @@ def main():
6768 data2 .attach (view2 )
6869 data2 .attach (view1 )
6970
70- print ("Setting Data 1 = 10" )
71+ print (u "Setting Data 1 = 10" )
7172 data1 .data = 10
72- print ("Setting Data 2 = 15" )
73+ print (u "Setting Data 2 = 15" )
7374 data2 .data = 15
74- print ("Setting Data 1 = 3" )
75+ print (u "Setting Data 1 = 3" )
7576 data1 .data = 3
76- print ("Setting Data 2 = 5" )
77+ print (u "Setting Data 2 = 5" )
7778 data2 .data = 5
78- print ("Detach HexViewer from data1 and data2." )
79+ print (u "Detach HexViewer from data1 and data2." )
7980 data1 .detach (view2 )
8081 data2 .detach (view2 )
81- print ("Setting Data 1 = 10" )
82+ print (u "Setting Data 1 = 10" )
8283 data1 .data = 10
83- print ("Setting Data 2 = 15" )
84+ print (u "Setting Data 2 = 15" )
8485 data2 .data = 15
8586
8687
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def scan(self):
1515 self .pos += 1
1616 if self .pos == len (self .stations ):
1717 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 )
1919
2020
2121class AmState (State ):
@@ -27,7 +27,7 @@ def __init__(self, radio):
2727 self .name = "AM"
2828
2929 def toggle_amfm (self ):
30- print ("Switching to FM" )
30+ print (u "Switching to FM" )
3131 self .radio .state = self .radio .fmstate
3232
3333
@@ -40,7 +40,7 @@ def __init__(self, radio):
4040 self .name = "FM"
4141
4242 def toggle_amfm (self ):
43- print ("Switching to AM" )
43+ print (u "Switching to AM" )
4444 self .radio .state = self .radio .amstate
4545
4646
Original file line number Diff line number Diff line change 1919https://github.com/pallets/werkzeug/blob/5a2bf35441006d832ab1ed5a31963cbc366c99ac/werkzeug/utils.py#L35
2020"""
2121
22-
22+ from __future__ import print_function
2323import functools
2424
2525
@@ -52,11 +52,11 @@ def relatives(self):
5252
5353def main ():
5454 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`:" )
5757 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`:" )
6060 print (Jhon .__dict__ )
6161
6262
You can’t perform that action at this time.
0 commit comments