Skip to content

Commit 4844e43

Browse files
committed
uv tool run --python=3.12 --from=future futurize --stage1 --write .
1 parent d25a29a commit 4844e43

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Diff for: capitulos/code/11-pythonic-obj/private/expose.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/env jython
22
# NOTE: Jython is still Python 2.7 in late2020
33

4+
from __future__ import print_function
5+
46
import Confidential
57

68
message = Confidential('top secret text')
79
secret_field = Confidential.getDeclaredField('secret')
810
secret_field.setAccessible(True) # break the lock!
9-
print 'message.secret =', secret_field.get(message)
11+
print('message.secret =', secret_field.get(message))
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env jython
22
# NOTE: Jython is still Python 2.7 in late2020
33

4+
from __future__ import print_function
5+
46
from java.lang.reflect import Modifier
57
import Confidential
68

@@ -10,5 +12,5 @@
1012
# list private fields only
1113
if Modifier.isPrivate(field.getModifiers()):
1214
field.setAccessible(True) # break the lock
13-
print 'field:', field
14-
print '\t', field.getName(), '=', field.get(message)
15+
print('field:', field)
16+
print('\t', field.getName(), '=', field.get(message))

Diff for: capitulos/code/11-pythonic-obj/private/no_respect.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
Set this to false and Jython provides access to non-public
1010
fields, methods, and constructors of Java objects.
1111
"""
12+
from __future__ import print_function
1213

1314
import Confidential
1415

1516
message = Confidential('top secret text')
1617
for name in dir(message):
1718
attr = getattr(message, name)
1819
if not callable(attr): # non-methods only
19-
print name + '\t=', attr
20+
print(name + '\t=', attr)

0 commit comments

Comments
 (0)