Buy ebook (Ebook) Python: The Complete Manual - The essential handbook for Python users - Master Python today! First Edition by Unknown ISBN 9781785462689, 1785462687 cheap price
Buy ebook (Ebook) Python: The Complete Manual - The essential handbook for Python users - Master Python today! First Edition by Unknown ISBN 9781785462689, 1785462687 cheap price
(Ebook) Python The Complete Manual: The Essential Handbook for Python
Users by Mehedi Hzn Press Publications
https://ebooknice.com/product/python-the-complete-manual-the-
essential-handbook-for-python-users-34099554
ebooknice.com
(Ebook) The Complete C++ & Python Manual by The Complete Manual Series
https://ebooknice.com/product/the-complete-c-python-manual-43690082
ebooknice.com
https://ebooknice.com/product/the-complete-python-coding-manual-18th-
edition-2023-50584730
ebooknice.com
(Ebook) The Complete Python & C++ Manual - 9th Edition 2022 by ,,,,
https://ebooknice.com/product/the-complete-python-c-manual-9th-
edition-2022-42004584
ebooknice.com
(Ebook) Python Developer's Handbook by Unknown
https://ebooknice.com/product/python-developer-s-handbook-56966628
ebooknice.com
https://ebooknice.com/product/python-the-complete-manual-5701248
ebooknice.com
(Ebook) C++ & Python for Beginners – 11th Edition 2022 by Unknown
https://ebooknice.com/product/c-python-for-beginners-11th-
edition-2022-44890860
ebooknice.com
(Ebook) Maya Python for Games and Film: A Complete Reference for Maya
Python and the Maya Python API by Adam Mechtley; Ryan Trowbridge ISBN
9780123785787, 0123785782
https://ebooknice.com/product/maya-python-for-games-and-film-a-
complete-reference-for-maya-python-and-the-maya-python-api-42933770
ebooknice.com
https://ebooknice.com/product/python-playground-geeky-projects-for-
the-curious-programmer-55377902
ebooknice.com
The Complete Manual
The essential handbook for Python users
Master
Python
today!
Welcome to
Python The Complete Manual
Python is a versatile language and its rise in popularity is
certainly no surprise. Its similarity to everyday language has
made it a perfect companion for the Raspberry Pi, which
is often a irst step into practical programming. But don’t
be fooled by its beginner-friendly credentials – Python has
plenty of more advanced functions. In this bookazine, you
will learn how to program in Python, discover amazing
projects to improve your understanding, and ind ways
to use Python to enhance your experience of computing.
You’ll also create fun projects including programming
a quadcopter drone and sending text messages from
Raspberry Pi. Let’s get coding!
Python The Complete Manual
Imagine Publishing Ltd
Richmond House
33 Richmond Hill
Bournemouth
Dorset BH2 6EZ
+44 (0) 1202 586200
Website: www.imagine-publishing.co.uk
Twitter: @Books_Imagine
Facebook: www.facebook.com/ImagineBookazines
Publishing Director
Aaron Asadi
Head of Design
Ross Andrews
Production Editor
Alex Hoskins
Designer
Perry Wardell-Wicks
Photographer
James Sheppard
Printed by
William Gibbons, 26 Planetary Road, Willenhall, West Midlands, WV13 3XT
Distributed in Australia by
Network Services (a division of Bauer Media Group), Level 21 Civic Tower, 66-68 Goulburn Street,
Sydney, New South Wales 2000, Australia, Tel +61 2 8667 5288
Disclaimer
The publisher cannot accept responsibility for any unsolicited material lost or damaged in the
post. All text and layout is the copyright of Imagine Publishing Ltd. Nothing in this bookazine may
be reproduced in whole or part without the written permission of the publisher. All copyrights are
recognised and used specifically for the purpose of criticism and review. Although the bookazine has
endeavoured to ensure all information is correct at time of print, prices and availability may change.
This bookazine is fully independent and not affiliated in any way with the companies mentioned herein.
Python is a trademark of Python Inc., registered in the U.S. and other countries.
Python © 2016 Python Inc
Python The Complete Manual First Edition © 2016 Imagine Publishing Ltd
Part of the
bookazine series
Contents
What you can ind inside the bookazine
Code
& create
with
Python!
6
Get started
with
Python 8 Masterclass
Discover the basics of Python
7
Always wanted to have a go at programming? No more
excuses, because Python is the perfect way to get started!
Python is a great programming language for both beginners and experts. It
is designed with code readability in mind, making it an excellent choice for
beginners who are still getting used to various programming concepts.
The language is popular and has plenty of libraries available, allowing
programmers to get a lot done with relatively little code.
You can make all kinds of applications in Python: you could use the
Pygame framework to write simple 2D games, you could use the GTK
libraries to create a windowed application, or you could try something
a little more ambitious like an app such as creating one using Python’s
Bluetooth and Input libraries to capture the input from a USB keyboard and
relay the input events to an Android phone.
For this tutorial we’re going to be using Python 2.x since that is the
version that is most likely to be installed on your Linux distribution.
In the following tutorials, you’ll learn how to create popular games using
Python programming. We’ll also show you how to add sound and AI to
these games.
8
Get started with Python Getting started
9
Hello World
Let’s get stuck in, and what better way than with the programmer’s
best friend, the ‘Hello World’ application! Start by opening a terminal.
Its current working directory will be your home directory. It’s probably
a good idea to make a directory for the iles that we’ll be creating in
this tutorial, rather than having them loose in your home directory.
You can create a directory called Python using the command mkdir
Python. You’ll then want to change into that directory using the
command cd Python.
The next step is to create an empty ile using the command ‘touch’
followed by the ilename. Our expert used the command touch
hello_world.py. The inal and most important part of setting up the
ile is making it executable. This allows us to run code inside the hello_
world.py ile. We do this with the command chmod +x hello_world.
py. Now that we have our ile set up, we can go ahead and open it up
in nano, or alternatively any text editor of your choice. Gedit is a great
editor with syntax highlighting support that should be available on any
distribution. You’ll be able to install it using your package manager if
you don’t have it already.
Our Hello World program is very simple, it only needs two lines.
The irst line begins with a ‘shebang’ (the symbol #! – also known
10
Get started with Python Getting started
#!/usr/bin/env python2
print(“Hello World”)
As well as these main data types, there are sequence types (technically,
Tip a string is a sequence type but is so commonly used we’ve classed it
At this point, it’s worth explaining as a main data type):
that any text in a Python ile
that follows a # character will be
ignored by the interpreter. This List Contains a collection of data in a speciic order
is so you can write comments in
your code. Tuple Contains a collection immutable data in a speciic
order
12
Get started with Python Getting started
You could
hello_list = list()
also create the
hello_list.append(“Hello,”)
same list in the
hello_list.append(“this”)
following way
hello_list.append(“is”)
hello_list.append(“a”)
hello_list.append(“list”)
13
Getting started Get started with Python
We might as well as we# are using the same variable name as the
create a dictionary previous list.
while we’re at it.
Notice how we’ve hello_dict = { “first_name” : “Liam”,
aligned the colons “last_name” :
below to make the “Fraser”,
code tidy “eye_colour” : “Blue” }
Remember
that tuples are print(str(hello_tuple[0]))
immutable, # We can’t change the value of those elements
although we like we just did with the list
can access the # Notice the use of the str function above to
elements of them explicitly convert the integer
like so # value inside the tuple to a string before
printing it.
Let’s create a
sentence using
the data in our print(hello_dict[“irst_name”] + “ “ + hello_
hello_dict dict[“last_name”] + “ has “ +
hello_dict[“eye_colour”] + “ eyes.”)
A much tidier way
of doing this would
be to use Python’s print(“{0} {1} has {2} eyes.”.format(hello_
string formatter dict[“irst_name”],
hello_dict[“last_name”],
hello_dict[“eye_colour”]))
14
Get started with Python Getting started
Indentation in detail
Control structures
In programming, a control structure is any kind of statement that can
change the path that the code execution takes. For example, a control
structure that decided to end the program if a number was less than 5
would look something like this:
#!/usr/bin/env python2
import sys # Used for the sys.exit function
int_condition = 5
if int_condition < 6:
sys.exit(“int_condition must be >= 6”)
else:
print(“int_condition was >= 6 - continuing”)
The path that the code takes will depend on the value of
the integer int_condition. The code in the ‘if’ block will only be
executed if the condition is true. The import statement is used to
load the Python system library; the latter provides the exit function,
allowing you to exit the program, printing an error message. Notice
that indentation (in this case four spaces per indent) is used to indicate
which statement a block of code belongs to. ‘If’ statements are
probably the most commonly used control structures. Other control
[liam@liam-laptop Python]$ ./
construct.py
How many integers? acd
You must enter an integer
[liam@liam-laptop Python]$ ./
construct.py
How many integers? 3
Please enter integer 1: t
You must enter an integer
Please enter integer 1: 5
Please enter integer 2: 2
Please enter integer 3: 6
Using a for loop
5
2
6
Using a while loop
5
2
6
#!/usr/bin/env python2
ints = list()
These are used
to keep track
count = 0
of how many
integers we
currently have
17
Getting started Get started with Python
if isint == True:
# Add the integer to the collection
ints.append(new_int)
# Increment the count by 1
By now, the
user has given count += 1
up or we have
a list filled with
integers. We can
print(“Using a for loop”)
loop through
for value in ints:
these in a couple
print(str(value))
of ways. The first
is with a for loop
# Or with a while loop:
print(“Using a while loop”)
# We already have the total above, but knowing
18
Get started with Python Getting started
def modify_string_return(original):
original += “ that has been
modified.”
# However, we can return our local copy to the
We are now outside caller. The function# ends as soon as the return
of the scope of statement is used, regardless of where it # is in
the modify_string the function.
function, as we have
return original
reduced the level of
indentation
test_string = “This is a test string”
The test string
won’t be changed modify_string(test_string)
in this code print(test_string)
test_string = modify_string_
return(test_string)
print(test_string)
#!/usr/bin/env python2
cont = False
if cont:
var = 1234
print(var)
In the section of code above, Python will convert the integer to a string
before printing it. However, it’s always a good idea to explicitly convert
things to strings – especially when it comes to concatenating strings
together. If you try to use the + operator on a string and an integer,
there will be an error because it’s not explicitly clear what needs to
happen. The + operator would usually add two integers together.
Having said that, Python’s string formatter that we demonstrated
earlier is a cleaner way of doing that. Can you see the problem? Var has
only been deined in the scope of the if statement. This means that we
get a very nasty error when we try to access var.
If cont is set to True, then the variable will be created and we can
access it just ine. However, this is a bad way to do things. The correct
way is to initialise the variable outside of the scope of the if statement.
#!/usr/bin/env python2
cont = False
var = 0
if cont:
var = 1234
if var != 0:
print(var)
21
Getting started Get started with Python
Comparison operators
The common comparison operators available in Python include:
< strictly less than
<= less than or equal
> strictly greater than
>= greater than or equal
== equal
!= not equal
22
Get started with Python Getting started
Coding style
It’s worth taking a little time to talk about coding style. It’s simple to
write tidy code. The key is consistency. For example, you should always
name your variables in the same manner. It doesn’t matter if you want
to use camelCase or use underscores as we have. One crucial thing is
to use self-documenting identiiers for variables. You shouldn’t have
to guess what a variable does. The other thing that goes with this is to
always comment your code. This will help anyone else who reads your
code, and yourself in the future. It’s also useful to put a brief summary
at the top of a code ile describing what the application does, or a part
of the application if it’s made up of multiple iles.
Summary
This article should have introduced you to the basics of programming
in Python. Hopefully you are getting used to the syntax, indentation
and general look and feel of a Python program. The next step is
to learn how to come up with a problem that you want to solve,
and break it down into small steps that you can implement in a
programming language. Google, or any other search engine, is very
helpful. If you are stuck with anything, or have an error message you
can’t work out how to ix, stick it into Google and you should be a lot
closer to solving your problem. For example, if we Google ‘play mp3
ile with python’, the irst link takes us to a Stack Overlow thread with
a bunch of useful replies. Don’t be afraid to get stuck in – the real fun
of programming is solving problems one manageable chunk at a time.
23
Introducing Python Python essentials
Introducing
Python
Now that you’ve taken the irst steps with Python, it’s time
to begin using that knowledge to get coding. In this section,
you’ll ind out how to begin coding apps for Android operating
systems (p.32) and the worldwide web (p.26). These easy-to-
follow tutorials will help you to cement the Python language
that you’ve learned, while developing a skill that is very helpful
in the current technology market. We’ll inish up by giving you
50 essential Python tips (p.40) to increase your knowledge and
ability in no time.
24
Python essentials Introducing Python
25
Introducing Python Make web apps with Python
Python 2.7:
https://www.python.org/download/
Make web
apps with
releases/2.7/
Python
Python provides quick and easy way to build
applications, including web apps. Find out how to
use it to build a feature-complete web app
Python is known for its simplicity and capabilities. At this point it is
so advanced that there is nothing you cannot do with Python, and
conquering the web is one of the possibilities. When you are using
Python for web development you get access to a huge catalogue
of modules and community support – make the most of them.
Web development in Python can be done in many diferent
ways, right from using the plain old CGI modules to utilising fully
groomed web frameworks. Using the latter is the most popular
method of building web applications with Python, since it allows
you to build applications without worrying about all that low-level
implementation stuf. There are many web frameworks available for
Python, such as Django, TurboGears and Web2Py. For this tutorial
we will be using our current preferred option, Django.
26
Make web apps with Python Introducing Python
Configuring the
which allows automatic creation of
an admin interface of the site based
on the data model. The admin
04 This is the part where we
define the data model
for our app. Please see the inline
Django project
interface can be used to add and comments to understand what is
manage content for a Django site. happening here.
INSTALLED_APPS = (
From django.db import models:
# We are importing the
user authentication module so
as per our requirements. that we use the built
Edit ludIssueTracker/settings.py # in authentication model
as follows (only parts requiring ‘django.contrib.auth’, in this app
modification are shown): ‘django.contrib. from django.contrib.auth.
Database Settings: We will be contenttypes’, models import User
using SQLite3 as our database ‘django.contrib.sessions’, # We would also create an
system here. ‘django.contrib.sites’, admin interface for our app
NOTE: Red text indicates new ‘django.contrib.messages’, from django.contrib import
code or ‘django.contrib. admin
updated code. staticfiles’,
‘default’: { ‘django.contrib.admin’, # A Tuple to hold the
‘ENGINE’: # ‘django.contrib. multi choice char fields.
‘django.db.backends. admindocs’, # First represents the
sqlite3’, ) field name the second one
‘NAME’: ‘ludsite. repersents the display name
db3, Creating ludissues app ISSUE_STATUS_CHOICES = (
(‘new’, ‘New’),
(‘accepted’,’Accepted’),
Path settings
Django requires an absolute 03 In this step we will create the
primary app for our site, called
ludissues. To do that, we will use the
(‘reviewed’,’Reviewed’),
(‘started’,’Started’),
path for directory settings. (‘closed’,’Closed’),
But we want to be able to manage.py script:
)
pass in the relative directory $ python manage.py startapp
references. In order to do that
we will add a helper Python
function. Insert the following
code at the top of the settings.
py file: “When you are using Python for web
import os
def getabspath(*x):
development you get access to a huge
return os.path.join(os. catalogue of modules and support”
path.abspath(os.path.
27
Introducing Python Make web apps with Python
28
Make web apps with Python Introducing Python
defined while modelling the app? Creating the public user include(admin.site.urls)),
They are not here because they are interface for ludissues )
not supposed to be entered by the This ensures that all the requests will be
user. opened_on will automatically processed by ludissues.urls first.
set to the date time it is created and
modified_on will automatically set
07 At this point, the admin
interface is working. But
we need a way to display the Creating ludissues.url
to the date time on which an issue data that we have added using
is modified. the admin interface. But there is
Another cool thing is that
the owner field is automatically
no public interface. Let’s create
it now.
08 Create a urls.py file in the
app directory (ludissues/urls.
py) with the following content:
populated with all the users inside We will have to begin by
from django.conf.urls
the site. editing the main
import patterns, include, url
We have defined our list view to urls.py (ludIssueTracker/urls.py).
# use ludissues model
show ID, name, status, owner and urlpatterns = patterns(‘’,
from models import
‘modified on’ in the model. You
ludissues
can get to this view by navigating (r’^’,include(‘ludissues.
to http://localhost:8000/admin/ urls’)),
# dictionary with all the
ludissues/issue/. (r’^admin/’,
29
Introducing Python Make web apps with Python
template directory as
TEMPLATE_DIRS = ( “To display an issue list and details here,
)
getabspath(‘templates’)
we are using a Django feature called
generic views”
30
Make web apps with Python Introducing Python
31
Introducing Python Build an app for Android with Python
32
Build an app for Android with Python Introducing Python
the entire game. We've speciically the widget canvas, which we diferent properties that can be
made it a subclass of FloatLayout can use here to draw each of our set, like the pos and size of the
because this special layout is able widget shapes: rectangle, and you can check the
to position and size its children <Player>: Kivy documentation online for
in proportion to its own position canvas: all the diferent possibilities. The
Color:
and size – so no matter where we biggest advantage is that although
rgba: 1, 1, 1, 1
run it or how much we resize the Rectangle: we still declare simple canvas
window, it will place all the game pos: self.pos instructions, kv language is able
objects appropriately. size: self.size to detect what Kivy properties we
Next we can use Kivy's graphics have referred to and automatically
instructions to draw various <Ball>: track them, so when they are
shapes on our widgets. We'll just canvas: updated (the widget moves or is
Color:
demonstrate simple rectangles to resized) the canvas instructions
rgb: 1, 0.55, 0
show their locations, though there Rectangle: move to follow this!
are many more advanced options pos: self.pos
you might like to investigate. In size: self.size Fig 01
a Python ile we can apply any
instruction by declaring it on the <Block>: from kivy.app import App
canvas: from kivy.uix.widget import
canvas of any widget, an example
Color: Widget
of which is shown in Fig. 03. from kivy.uix.floatlayout
rgb: self.colour
This would draw a red rectangle # A property we import FloatLayout
with the same position and size predefined above from kivy.uix.modalview
as the player at its moment of Rectangle: import ModalView
instantiation – but this presents a pos: self.pos
problem, unfortunately, because size: self.size __version__ = '0.1' #
Color: Used later during Android
the drawing is static. When we
rgb: 0.1, 0.1, 0.1 compilation
later go on to move the player
Line:
widget, the red rectangle will class BreakoutApp(App):
rectangle:
stay in the same place, while the [self.x, self.y, pass
widget will be invisible when it is self.width, self.
in its real position. height] BreakoutApp().run()
We could ix this by keeping
references to our canvas The canvas declaration is special,
instructions and repeatedly underneath it we can write any Fig 02
updating their properties to track canvas instructions we like. Don't
from kivy.properties
the player, but there's actually an get confused, canvas is not a
import (ListProperty,
easier way to do all of this - we widget and nor are graphics
NumericProperty,
can use the Kivy language we instructions like Line. This is just
introduced last time. It has a a special syntax that is unique to O bje c t Pr o p e r t y,
special syntax for drawing on the canvas. Instructions all have StringProperty)
33
Introducing Python Build an app for Android with Python
34
Build an app for Android with Python Introducing Python
take this opportunity to do the positions and carrying out game if scancode == 275:
same for the other widgets as logic – in this case collisions with self.direction =
well (Fig. 05). the ball (Fig. 06). 'right'
This takes care of keeping all our The Clock can schedule elif scancode == 276:
self.direction = 'left'
game widgets positioned and any function at any time,
else:
sized in proportion to the Game either once or repeatedly. A self.direction = 'none'
containing them. Notice that the function scheduled at interval
Player and Ball use references to automatically receives the time def on_key_up(self, *args):
the properties we set earlier, so since its last call (dt here), which self.direction = 'none'
we'll be able to move them by we've passed through to the ball
just setting these properties and and player via the references we def update(self, dt):
dir_dict = {'right': 1,
letting kv language automatically created in kv language. It's good
'left': -1, 'none': 0}
update their positions. practice to scale the update (eg self.position += (0.5
The Ball also uses an extra ball distance moved) by this dt, * dt * dir_ dict[self.
property to remain square rather so things remain stable even if direction])
than rectangular, just because the something interrupts the clock These on_touch_ functions
alternative would likely look a little and updates don't meet the are Kivy's general method for
bit odd. regular 1/60s you want. interacting with touch or mouse
We've now almost inished At this point we have also input, they are automatically
the basic graphics of our app! All added the irst steps toward called when the input is detected
that remains is to add a Ball and a handling keyboard input, by and you can do anything you
Player widget to the Game. binding to the kivy Window to like in response to the touches
<Game>: call a method of the Player every you receive. In this case we set
ball: the_ball time a key is pressed. We can the Player's direction property
player: the_player then inish of the Player class by in response to either keyboard
Ball:
adding this key handler along and touch/mouse input, and
id: the_ball
Player: with touch/mouse input. use this direction to move the
id: the_player Player when its update method is
You can run the game again class Player(Widget): called. We can also add the right
def on_touch_down(self, behaviour for the ball (Fig. 07).
now, and should be able to see
touch):
all the graphics working properly. This makes the ball bounce of
self.direction = (
Nothing moves yet, but thanks to 'right' if touch.x > every wall by forcing its velocity
the FloatLayout everything should self.parent. center_x else to point back into the Game,
remain in proportion if you resize 'left') as well as bouncing from the
the game/window. player paddle – but with an extra
Now we just have to add the def on_touch_up(self, kick just to let the ball speed
touch): change. It doesn't yet handle any
game mechanics. For a game like
self.direction = 'none'
this you usually want to run some interaction with the blocks or
update function many times per def on_key_down(self, any win/lose conditions, but it
second, updating the widget keypress, scancode, *args): does try to call Game.lose() if the
35
Introducing Python Build an app for Android with Python
ball hits the bottom of the player's of your Android devices. You can size_hint: None, None
screen, so let's now add in some even access the normal Android proper_size:
game end code to handle all of this API to access hardware or OS min(0.03*self.parent.
height, 0.03*self.parent.width)
(Fig. 08). And then add the code in features such as vibration, sensors
size: self.proper_size,
Fig. 09 to your 'breakout.kv 'ile. or native notiications. self.proper_size
This should fully handle the We'll build for Android using # ... canvas part
loss or win, opening a pop-up the Buildozer tool, and a Kivy
with an appropriate message sister project wrapping other Fig 06
and providing a button to try build tools to create packages on from kivy.clock import
again. Finally, we have to handle diferent systems. This takes care Clock
destroying blocks when the ball of downloading and running from kivy.core.window
hits them (Fig. 10). the Android build tools (SDK, import Window
from kivy.utils import
This fully covers these last NDK, etc) and Kivy's Python-for- platform
conditions, checking collision Android tools that create the APK.
via Kivy's built-in collide_widget class Game(FloatLayout):
method that compares their Fig 04 def update(self, dt):
bounding boxes (pos and size). The self.ball.
import random update(dt) # Not defined yet
bounce direction will depend on self.player.
how far the ball has penetrated, as class Block(Widget): update(dt) # Not defined yet
this will tell us how it irst collided def __init__(self,
**kwargs): def start(self,
with the Block. super(Block,
So there we have it, you can *args):
self).__init__(**kwargs) Clock.schedule_
run the code to play your simple self.colour = interval(self.update, 1./60.)
Breakout game. Obviously it's very random.choice([
simple right now, but hopefully (0.78, 0.28, def stop(self):
0), )0.28, 0.63, 0.28), )0.25, Clock.
you can see lots of diferent ways 0.28, 0.78)])
to add whatever extra behaviour unschedule(self.update)
you like – you could add diferent Fig 05 def reset(self):
types of blocks and power-ups, a for block in
lives system, more sophisticated <Block>: self.blocks:
size_hint: 0.09, 0.05 self.remove_
paddle/ball interaction, or even
# ... canvas part widget(block)
build a full game interface with a
self.blocks = []
menu and settings screen as well. <Player>: self.setup_
We’re just going to inish size_hint: 0.1, 0.025 blocks()
showing one cool thing that you pos_hint: {'x': self. self.ball.velocity
can already do – compile your position, 'y': 0.1} = [random.random(), 0.5]
# ... canvas part self.player.
game for Android! Generally
position = 0.5
speaking you can take any Kivy <Ball>:
app and turn it straight into an pos_hint: {'x': self.pos_ class BreakoutApp(App):
Android APK that will run on any hint_x, 'y': self.pos_hint_y} def build(self):
36
Build an app for Android with Python Introducing Python
g = Game()
if platform() != def bounce_
Fig 09
'android': f r o m _ p l a y e r (s e lf,
Window. player): <GameEndPopup>:
bind(on_key_down=g.player. if self. size_hint: 0.8, 0.8
on_key_down) collide_widget(player): auto_dismiss: False
Window. self. # Don't close if player
bind(on_key_up=g.player.on_ velocity[1] = abs(self. clicks outside
key_up) velocity[1]) BoxLayout:
g.reset() orientation:
self.
Clock.schedule_ 'vertical'
velocity[0] += (
once(g.start, 0) Label:
return g 0.1
* ((self.center_x - text: root.
player.center_x) / message
Fig 07 font_size:
player.width)) 60
markup: True
class Ball(Widget)
def update(self, dt): halign:
Fig 08 'center'
self.pos_hint_x
+= self.velocity[0] * dt Button:
c l a s s size_hint_y:
self.pos_hint_y GameEndPopup(ModalView):
+= self.velocity[1] * dt None
message = height:
if self.right > StringProperty()
self.parent.right: # Bounce sp(80)
game = text: 'Play
from right
ObjectProperty() again?'
self.
velocity[0] = -1 * abs(self. font_size:
class Game(Widget): 60
velocity[0])
def lose(self): on_release:
if self.x < self.
parent.x: # Bounce from left self.stop() root.game.start(); root.
self. GameEndPopup( dismiss()
velocity[0] = abs(self. message='[color=#ff0000]You
lose![/color]', Here you will be needing
velocity[0]) some basic dependencies, which
if self.top
game=self).open() can be installed with ease just
> self.parent.top: # Bounce
from top by using your distro's normal
self. def win(self): # repositories. The main ones to use
velocity[1] = -1 * abs(self. Not called yet, but we'll are OpenJDK7, zlib, an up-to-date
velocity[1]) need it later Cython, and Git. If you are using
if self.y < self. self.stop() a 64-bit distro you will also be
parent.y: # Lose at bottom GameEndPopup(
in need of 32-bit compatibility
self.parent. message='[color=#00ff00]You
win![/color]', libraries for zlib, libstdc++, as well
lose() # Not implemented yet
self.bounce_from_ as libgcc. You can then go on and
player(self.parent.player) game=self).open() download and install Buildozer:
37
Introducing Python Build an app for Android with Python
Putting your APK “Check through the whole ile just to see
on the Play Store
what’s available, but most of the default
Find out how to digitally sign a
release APK and upload it to an settings will be ine”
app store of your choice
1Build
APK
and sign a release
if len(self.
Fig 10 blocks) == 0:
self.
2Sign up as a Google Play
Developer
Visit https://play.google.com/
self.parent.do_ apps/publish/signup, and follow
win()
layout() the instructions. You'll need to
return # pay a one-of $25 charge, but
self.parent.destroy_
Only remove at most 1 block then you can upload as many
blocks(self) apps as you like.
per frame
class Game(FloatLayout):
def destroy_blocks(self, Fig 11 3Upload
store
your app to the
ball.velocity[0] *=
-1
else:
ball.velocity[1] *=
-1
self.
remove_widget(block)
self.blocks. Above Your game should run on any modern
Android device… you can even build a release
pop(i) version and publish to an app store!
39
Introducing Python 50 Python tips
50 Python tips
Python is a programming language that lets you work more quickly and
integrate your systems more efectively. Today, Python is one of the most popular
programming languages in the open source space. Look around and you will
ind it running everywhere, from various coniguration tools to XML parsing. Here
is the collection of 50 gems to make your Python experience worthwhile…
40
50 Python tips Introducing Python
09 Example:
The built-in function ‘dir()’ can
be used to find out which names a
commands at the startup of
any Python script by using
the environment variable
Tab key.
Python
module defines. It returns a sorted list $PYTHONSTARTUP. You can
of strings. set environment variable documentation tool
>>> import time $PYTHONSTARTUP to a file which
>>> dir(time)
[‘__doc__’, ‘__file__’,
‘__name__’, ‘__package__’,
contains the instructions load
necessary modules or commands . 16 You can pop up a graphical
interface for searching the
Python documentation using the
‘accept2dyear’, ‘altzone’, Converting a string command:
‘asctime’, ‘clock’, ‘ctime’, to date object $ pydoc -g
‘daylight’, ‘gmtime’, ‘localtime’, You will need python-tk package for
‘mktime’, ‘sleep’, ‘strftime’, this to work.
‘strptime’, ‘struct_time’,
‘time’, ‘timezone’, ‘tzname’,
13 You can use the function
‘DateTime’ to convert a string to a
date object.
‘tzset’]file’] Example:
Module internal
from DateTime import DateTime “Today, Python is
documentation
dateobj = DateTime(string)
certainly one of
Converting a string
the most popular
10 You can see the internal
documentation (if available) of to date object programming
a module name by looking at languages to be
.__doc__.
Example: 14 You can convert a list to string
in the following ways. found in the open
>>> import time
>>> print time.clock.__doc__
1st method:
>>> mylist = [‘spam’, ‘ham’,
source space”
clock() -> floating
41
Introducing Python 50 Python tips
42
50 Python tips Introducing Python
43
Introducing Python 50 Python tips
45
Random documents with unrelated
content Scribd suggests to you:
praise God, with a loud voice, for all the mighty works that they had
seen; saying, “Blessed be the King of Israel, that cometh in the
name of the Lord! Peace in heaven! Glory in the highest! Blessed be
the kingdom of our father David! Hosanna!” These acclamations
were raised by the disciples, and heartily joined in by the multitudes
who knew his wonderful works, and more especially those who were
acquainted with the very recent miracle of raising Lazarus. A great
sensation of wonder was created throughout the city, by such a burst
of shouts from a multitude, sweeping in a long, imposing train, with
palm branches in their hands, down the mountain, on which they
could have been seen all over Jerusalem. As he entered the gates,
all the city was moved to say, “Who is this?” And the rejoicing
multitude said, “This is Jesus, the prophet of Nazareth in Galilee.”
What scorn did not this reply awaken in many of the haughty
aristocrats of Jerusalem, to learn that all this solemn parade had
been got up for no better purpose than merely to honor a dweller of
that outcast region of mongrels, Galilee! And of all places, that this
prophet, so called, should have come from Nazareth! A prophet from
Galilee, indeed! Was it from this half-heathen district, that the
favored inhabitants of the capital of Judaism were to receive a
teacher of religion? Were the strict faith, and the rigid observances of
their learned and devout, to be displaced by the presumptuous
reformations of a self-taught prophet, from such a country? Swelling
with these feelings, the Pharisees could not repress a remonstrance
with Jesus, against these noisy proceedings. But he, evidently
affected with pleasure at the honest tribute thus wrung out in spite of
sectional feeling, forcibly asserted the propriety and justice of this
free offering of praise. “I tell you, that if these should hold their
peace, the stones would immediately cry out.”
With palm-branches in their hands.――This tree, the emblem of joy and triumph in every
part of the world where it is known, was the more readily adopted on this occasion, by those
who thronged to swell the triumphal train of Jesus of Nazareth, because the palm grew
along the way-side where they passed, and the whole mount was hardly less rich in this
than in the far famed olive from which it drew its name. A proof of the abundance of the
palm-trees on Olivet is found in the name of the village of Bethany, בית חיני, (beth-hene,)
“house of dates,” which shows that the tree which bore this fruit must have been plentiful
there. The people, as they passed on with Jesus from this village whence he started to
enter the city, would therefore find this token of triumph hanging over their heads, and
shading their path every where within reach, and the emotions of joy at their approach to
the city of God in the company of this good and mighty prophet, prompted them at once to
use the expressive emblems which hung so near at hand; and which were alike within the
reach of those who journeyed with Jesus, and those who came forth from the city to meet
and escort him in. The presence of these triumphal signs would, of course, remind them at
once of the feast of the tabernacles, the day on which, in obedience to the Mosaic statute,
all the dwellers of the city were accustomed to go forth to the mount, and bring home these
branches with songs of joy. (Leviticus xxiii. 40, Nehemiah viii. 15, 16.) The remembrance of
this festival at once recalled also the beautifully appropriate words of the noble national and
religious hymn, which they always chanted in praise of the God of their fathers on that day,
(see Kuinoel, Rosenmueller, Wolf, &c.) and which was so peculiarly applicable to him who
now “came in the name of the Lord,” to honor and to bless his people. (Psalm cxviii. 26.)
The descent of the Mount of Olives.――To imagine this scene, with something of the
force of reality, it must be remembered that the Mount of Olives, so often mentioned in the
scenes of Christ’s life, rose on the eastern side of Jerusalem beyond the valley of the
Kedron, whose little stream flowed between this mountain and Mount Moriah, on which the
temple stood. Mount Olivet was much higher than any part of the city within the walls, and
the most commanding and satisfactory view of the holy city which modern travelers and
draughtsmen have been able to present to us in a picture, is that from the more than classic
summit of this mountain. The great northern road passing through Jericho, approaches
Jerusalem on its north-eastern side, and comes directly over the top of Olivet, and as it
mounts the ridge, it brings the holy city in all its glory, directly on the traveler’s view.
Hosanna.――This also is an expression taken from the same festal hymn, (Psalm cxviii.
25,) ( הושיעה־נאhoshia-na) a pure Hebrew expression, as Drusius shows, and not Syriac,
(See Poole’s Synopsis on Matthew xxi. 9,) but corrupted in the vulgar pronunciation of this
frequently repeated hymn, into Hosanna. The meaning of the Hebrew is “save him” or “be
gracious to him,” that is in connection with the words which follow in the gospel story, “Be
gracious, O Lord, to the son of David.” This is the same Hebrew phrase which, in the psalm
above quoted, (verse 25,) is translated “Save now.” The whole expression was somewhat
like the English “God save the king,” in its import.
Nazareth.――This city, in particular, had an odious name, for the general low character
of its inhabitants. The passage in John i. 46, shows in what estimation this city and its
inhabitants were held, by their own neighbors in Galilee; and the great scorn with which all
Galileans were regarded by the Jews, must have redoubled their contempt of this poor
village, so despised even by the despicable. The consequence was that the Nazarenes
acquired so low a character, that the name became a sort of byword for what was mean and
foolish. (See Kuinoel on Matthew ii. 23, John i. 46. Also Rosenmueller on the former
passage and Bloomfield on the latter.)
Galilee.――In order to appreciate fully, the scorn and suspicion with which the Galileans
were regarded by the citizens of Jerusalem, a complete view of their sectional peculiarities
would be necessary. Such a view will hereafter be given in connection with a passage which
more directly refers to those peculiarities, and more especially requires illustration and
explanation.
In preparing his disciples for the great events which were to take
place in a few years, and which were to have a great influence on
their labors, Jesus foretold to them the destruction of the temple. As
he was passing out through the mighty gates of the temple on some
occasion with his disciples, one of them, admiring the gorgeous
beauty of the architecture and the materials, with all the devotion of a
Jew now visiting it for the first time, said to him, “Master, see! what
stones and what buildings!” To him, Jesus replied with the awful
prophecy, most shocking to the national pride and religious
associations of every Israelite,――that ere long, upon that glorious
pile should fall a ruin so complete, that not one of those splendid
stones should be left upon another. These words must have made a
strong impression of wonder on all who heard them; but no farther
details of the prophecy were given to the disciples at large. Not long
afterwards, however, as he sat musingly by himself, in his favorite
retirement, half-way up the Mount of Olives, over against the temple,
the four most loved and honored of the twelve, Peter, James, John
and Andrew, came to him, and asked him privately, to tell them when
these things should be, and by what omen they should know the
approach of the great and woful ruin. Sitting there, they had a full
view of the enormous pile which rose in immense masses very near
them, on the verge of mount Moriah, and was even terraced up, from
the side of the slope, presenting a vast wall, rising from the depths of
the deep ravine of Kedron, which separated the temple from mount
Olivet, where they were. It was morning when the conversation took
place, as we may fairly guess, for this spot lay on the daily walk to
Bethany, where he lodged;――the broad walls, high towers, and
pillars of the temple, were doubtless illuminated by the full splendors
of the morning sun of Palestine; for Olivet was directly east of
Jerusalem, and as they sat looking westward towards the temple,
with the sun behind them, the rays, leaving their faces in the shade,
would shine full and bright on all which crowned the highth beyond. It
was at such a time, as the Jewish historian assures us, that the
temple was seen in its fullest grandeur and sublimity; for the light,
falling on the vast roofs, which were sheeted and spiked with pure
gold, brightly polished, and upon the turrets and pinnacles which
glittered with the same precious metal, was reflected to the eye of
the gazer with an insupportable brilliancy, from the million bright
surfaces and shining points which covered it. Here, then, sat Jesus
and his four adoring chosen ones, with this splendid sight before
them crowning the mountain, now made doubly dazzling by contrast
with the deep gloom of the dark glen below, which separated them
from it. There it was, that, with all this brightness and glory and
beauty before them, Jesus solemnly foretold in detail the awful, total
ruin which was to sweep it all away, within the short lives of those
who heard him. Well might such words sink deep into their
hearts,――words coming from lips whose perfect and divine truth
they could not doubt, though the things now foretold must have gone
wofully against all the dreams of glory, in which they had made that
sacred pile the scene of the future triumphs of the faith and followers
of Christ. This sublime prophecy, which need not here be repeated
or descanted upon, is given at great length by all the first three
evangelists, and is found in Matthew xxiv. Mark xiii. and Luke xxi.
The view of the temple.――I can find no description by any writer, ancient or modern,
which gives so clear an account of the original shape of Mount Moriah, and of the
modifications it underwent to fit it to support the temple, as that given by Josephus. (Jewish
War, book V. chapter v.) In speaking of the original founding of the temple by Solomon,
(Antiquities book VIII. chapter iii. section 2,) he says, “The king laid the foundations of the
temple in the very depths, (at the bottom of the descent,) using stones of a firm structure,
and able to hold out against the attacks of time, so that growing into a union, as it were, with
the ground, they might be the basis and support of the pile that was to be reared above, and
through their strength below, easily bear the vast mass of the great superstructure, and the
immense weight of ornament also; for the weight of those things which were contrived for
beauty and magnificence was not less than that of the materials which contributed to the
highth and lateral dimension.” In the full description which he afterwards gives in the place
first quoted, of the later temple as perfected by Herod, which is the building to which the
account in the text refers, he enters more fully into the mode of shaping the ground to the
temple. “The temple was founded upon a steep hill, but in the first beginning of the structure
there was scarcely flat ground enough on the top for the sanctuary and the altar, for it was
abrupt and precipitous all around. And king Solomon, when he built the sanctuary, having
walled it out on the eastern side, (εκτειχισαντος, that is, ‘having built out a wall on that side’
for a terrace,) then reared upon the terraced earth a colonnade; but on the other sides the
sanctuary was naked,――(that is, the wall was unsupported and unornamented by
colonnades as it was on the east.) But in the course of ages, the people all the while
beating down the terraced earth with their footsteps, the hill thus growing flat, was made
broader on the top; and having taken down the wall on the north, they gained considerable
ground which was afterwards inclosed within the outer court of the temple. Finally, having
walled the hill entirely around with three terraces, and having advanced the work far beyond
any hope that could have been reasonably entertained at first, spending on it long ages,
and all the sacred treasures accumulated from the offerings sent to God from the ends of
the world, they reared around it, both the upper courts and the lower temple, walling the
latter up, in the lowest part, from a depth of three hundred cubits, (450 feet,) and in some
places more. And yet the whole depth of the foundations did not show itself, because they
had greatly filled up the ravines, with a view to bring them to a level with the streets of the
city. The stones of this work were of the size of forty cubits, (60 feet,) for the profusion of
means and the lavish zeal of the people advanced the improvements of the temple beyond
account; and a perfection far above all hope was thus attained by perseverance and time.
“And well worthy of these foundations were the works which stood upon them. For all the
colonnades were double, consisting of pillars twenty-five cubits (40 feet) in highth, each of a
single stone of the whitest marble, and were roofed with fretwork of cedar. The natural
beauty of these, their high polish and exquisite proportion, presented a most glorious show;
but their surface was not marked by the superfluous embellishments of painting and
carving. The colonnades were thirty cubits broad, (that is, forty-five feet from the front of the
columns to the wall behind them;) while their whole circuit embraced a range of six stadia,
(more than three-quarters of a mile!) including the castle of Antonia. And the whole
hypethrum (ὑπαιθρον, the floor of the courts or inclosures of the temple, which was exposed
to the open air, there being no roof above it) was variegated by the stones of all colors with
which it was laid,” (making a Mosaic pavement.) Section 1.
“The outside of the temple too, lacked nothing that could strike or dazzle the mind and
eye. For it was on all sides overlaid with massy plates of gold, so that in the first light of the
rising sun, it shot forth a most fiery splendor, which turned away the eyes of those
who compelled themselves (mid. βιαζομενους) to gaze on it, as from the rays of the sun
itself. To strangers, moreover, who were coming towards it, it shone from afar like a
complete mountain of snow: for where it was not covered with gold it was most dazzlingly
white, and above on the roof it had golden spikes, sharpened to keep the birds from lighting
on it. And some of the stones of the building were forty-five cubits long, five high, and six
broad;”――(or sixty-seven feet long, seven and a half high, and nine broad.) Section 6.
“The Antonia was placed at the angle made by the meeting of two colonnades of the
outer temple, the western and the northern. It was built upon a rock, fifty cubits high, and
precipitous on all sides. It was the work of king Herod, in which, most of all, he showed
himself a man of exalted conceptions.” Section 8.
In speaking of Solomon’s foundation, he also says, (Antiquities book VIII. chapter iii.
section 9,)
“But he made the outside of the temple wonderful beyond account, both in description
and to sight. For having piled up huge terraces, from which, on account of their immense
depth, it was hardly possible to look down, and reared them to the highth of four hundred
cubits, (six hundred feet!) he made them on the same level with the hill’s top on which the
shrine (ναος) was built, and thus the open floor of the temple (ἱερον, or the outer court’s
inclosure) was level with the shrine.”
I have drawn thus largely from the rich descriptions of this noble and faithful describer of
the old glories of the Holy Land, because this very literal translation gives the exact naked
detail of the temple’s aspect, in language as gorgeous as the most high-wrought in which it
could be presented in a mere fancy picture of the same scene; and because it will prove
that my conception of its glory, as it appeared to Christ and the four disciples who “sat over
against it upon the Mount of Olives,” is not overdrawn, since it is thus supported by the
blameless and invaluable testimony of him who saw all this splendor in its most splendid
day, and afterwards in its unequaled beauty and with all its polished gold and marble,
shining and sinking amid the flames, which swept it utterly away from his saddening eyes
forever, to a ruin the most absolute and irretrievable that ever fell upon the works of man.
This was the temple on which the sons of Jonah and Zebedee gazed, with the awful
denunciation of its utter ruin falling from their Lord’s lips, and such was the desolation to
which those terrible words devoted it. This full description of its location shows the manner
in which its terraced foundations descended with their vast fronts, six hundred feet into the
valley of Kedron, over which they looked. To give as clear an idea of the place where they
sat, and its relations to the rest of the scene, I extract from Conder’s Modern Traveler the
following description of Mount Olivet.
“The Mount of Olives forms part of a ridge of limestone hills, extending to the north and
the south-west. Pococke describes it as having four summits. On the lowest and most
northerly of these, which, he tells us, is called Sulman Tashy, the stone of Solomon, there is
a large domed sepulcher, and several other Mohammedan tombs. The ascent to this point,
which is to the north-east of the city, he describes as very gradual, through pleasant corn-
fields planted with olive-trees. The second summit is that which overlooks the city: the path
to it rises from the ruined gardens of Gethsemane, which occupy part of the valley. About
half way up the ascent is a ruined monastery, built, as the monks tell us, on the spot where
the Savior wept over Jerusalem. From this point the spectator enjoys, perhaps, the best
view of the Holy City. (Here Jesus sat, in our scene.)
“The valley of Jehoshaphat, which lies between this mountain and the hills on which
Jerusalem is built, is still used as a burial-place by the modern Jews, as it was by their
ancestors. It is, generally speaking, a rocky flat, with a few patches of earth here and there,
about half a mile in breadth from the Kedron to the foot of Mount Olivet, and nearly of the
same length from Siloa to the garden of Gethsemane. The Jews have a tradition, evidently
founded on taking literally the passage Joel iii. 12, that this narrow valley will be the scene
of the final judgment. The prophet Jeremiah evidently refers to the same valley under the
name of the valley of the Son of Hinnom, or the valley of Tophet, the situation being clearly
marked as being by the entry of the east gate. (Jeremiah xix. 2, 6.) Pococke places the
valley of Hinnom to the south of Jerusalem, but thinks it might include part of that to the
east. It formed part of the bounds between the tribes of Benjamin and Judah, (Joshua xv. 8.
xviii. 16,) but the description is somewhat obscure.” [Modern Traveler Palestine, pp. 168,
172.]
MOUNT MORIAH.
Shortly after, in the same place and during the same meeting,
Jesus speaking to them of his near departure, affectionately and
sadly said, “Little children, but a little while longer am I with you. Ye
shall seek me; and as I said to the Jews, ‘whither I go, ye cannot
come,’――so now I say to you.” To this Simon Peter soon after
replied by asking him, “Lord whither goest thou?” Jesus answered
him, “Whither I go thou canst not follow me now, but thou shalt follow
me afterwards.” Peter, perhaps beginning to perceive the mournful
meaning of this declaration, replied, still urging, “Lord, why cannot I
follow thee now? I will lay down my life for thy sake.” Jesus
answered, “Wilt thou lay down thy life for my sake? I tell thee
assuredly, the cock shall not crow till thou hast denied me
thrice.”――Soon after, at the same time and place, noticing the
confident assurance of this chief disciple, Jesus again warned him of
his danger and his coming fall. “Simon! Simon! behold, Satan has
desired to have you (all) that he may sift you as wheat; but I have
prayed for thee (especially) that thy faith fail not; and when thou art
converted, strengthen thy brethren.” Never before had higher and
more distinctive favor been conferred on this chief apostle, than by
this sad prophecy of danger, weakness and sin, on which he was to
fall, for a time, to his deep disgrace; but on him alone, when rescued
from ruin by his Master’s peculiar prayers, was to rest the task of
strengthening his brethren. But his Master’s kind warning was for the
present lost on his immovable self-esteem; he repeated his former
assurance of perfect devotion through every danger, “Lord, I am
ready to go with thee into prison and to death.” Where was
affectionate and heroic devotion ever more affectingly and
determinedly expressed? What heart of common man would not
have leaped to meet such love and fidelity? But He, with an eye still
clear and piercing, in spite of the tears with which affection might dim
it, saw through the veil that would have blinded the sharpest human
judgment, and coldly met these protestations of burning zeal with the
chilling prediction again uttered, “I tell thee, Peter, the cock shall not
crow this day, before thou shalt thrice deny that thou knowest me.”
Then making a sudden transition, to hint to them the nature of the
dangers which would soon try their souls, he suddenly reverted to
their former security. “When I sent you forth without purse, or scrip,
or shoes, did ye need any thing?” And they said “Nothing.” Then said
he to them “But now, let him that has a purse, take it, and likewise
his scrip; and let him that has no sword sell his cloak and buy one.”
They had hitherto, in their wanderings, every where found friends to
support and protect them; but now the world was at war with them,
and they must look to their own resources both for supplying their
wants and guarding their lives. His disciples readily apprehending
some need of personal defense, at once bestirred themselves and
mustered what arms they could on the spot, and told him that they
had two swords among them, and of these it appears that one was in
the hands of Peter. It was natural enough that among the disciples
these few arms were found, for they were all Galileans, who, as
Josephus tells us, were very pugnacious in their habits; and even the
followers of Christ, notwithstanding their peaceful calling, had not
entirely laid aside their former weapons of violence, which were the
more needed by them, as the journey from Galilee to Jerusalem was
made very dangerous by robbers, who lay in wait for the defenseless
traveler wherever the nature of the ground favored such an attack.
Of this character was that part of the road between Jerusalem and
Jericho, alluded to in the parable of the wounded traveler and the
good Samaritan,――a region so wild and rocky that it has always
been dangerous, for the same reasons, even to this day; of which a
sad instance occurred but a few years ago, in the case of an eminent
English traveler, who going down from Jerusalem to Jericho, fell
among thieves and was wounded near the same spot mentioned by
Christ, in spite of the defenses with which he was provided. It was in
reference to such dangers as these, that two of his disciples had
provided themselves with hostile weapons, and Peter may have
been instigated to carry his sword into such a peaceful feast, by the
suspicion that the danger from the chief priests, to which Christ had
often alluded, might more particularly threaten them while they were
in the city by themselves, without the safeguard of their numerous
friends in the multitude. The answer of Jesus to this report of their
means of resistance was not in a tone to excite them to the very
zealous use of them. He simply said, “It is enough,” a phrase which
was meant to quiet them, by expressing his little regard for such a
defense as they were able to offer to him, with this contemptible
armament.
Some have conjectured that this washing of feet (page 97) was a usual rite at the
Paschal feast. So Scaliger, Beza, Baronius, Casaubon and other learned men have
thought. (See Poole’s Synopsis, on John xiii. 5.) But Buxtorf has clearly shown the falsity of
their reasons, and Lightfoot has also proved that it was a perfectly unusual thing, and that
there is no passage in all the Rabbinical writings which refers to it as a custom. It is
manifest indeed, to a common reader, that the whole peculiar force of this ablution, in this
instance, consisted in its being an entirely unusual act; and all its beautiful aptness as an
illustration of the meaning of Jesus,――that they should cease their ambitious strife for
precedence,――is lost in making it anything else than a perfectly new and original
ceremony, whose impressiveness mainly consisted in its singularity. Lightfoot also illustrates
the design of Jesus still farther, by several interesting passages from the Talmudists,
showing in what way the ablution would be regarded by his disciples, who like other Jews
would look upon it as a most degraded action, never to be performed except by inferiors to
superiors. These Talmudic authorities declare, that “Among the duties to be performed by
the wife to her husband, this was one,――that she should wash his face, his hands and his
feet.” (Maimonides on the duties of women.) The same office was due from a son to his
father,――from a slave to his master, as his references show; but he says he can find no
precept that a disciple should perform such a duty to his teacher, unless it be included in
this, “The teacher should be more honored by his scholar than a father.”
He also shows that the feet were never washed separately, with any idea of legal
purification,――though the Pharisees washed their hands separately with this view, and the
priests washed their hands and feet both, as a form of purification, but never the feet alone.
And he very justly remarks upon all this testimony, that “the farther this action of Christ
recedes from common custom, the higher its fitness for their instruction,――being
performed not merely for an example but for a precept.” (Lightfoot’s Horae Hebraica in
Gospel of John xiii. 5.)
Laid aside his garments.――The simple dress of the races of western Asia, is always
distinguishable into two parts or sets of garments,――an inner, which covered more or less
of the body, fitting it tightly, but not reaching far over the legs or arms, and consisted either
of a single cloth folded around the loins, or a tunic fastened with a girdle; sometimes also a
covering for the thighs was subjoined, making something like the rudiment of a pair of
breeches. (See Jahn Archaeologia Biblica § 120.) These were the permanent parts of the
dress, and were always required to be kept on the body, by the common rules of decency.
But the second division of the garments, (“superindumenta,” Jahn,) thrown loosely over the
inner ones, might be laid aside, on any occasion, when active exertion required the most
unconstrained motion of the limbs. One of these was a simple oblong, broad piece of cloth,
of various dimensions, but generally about three yards long, and two broad, which was
wrapped around the body like a mantle, the two upper corners being drawn over the
shoulders in front, and the rest hanging down the back, and falling around the front of the
body, without any fastenings but the folding of the upper corners. This garment was called
by the Hebrews שמלהor שלמה, (simlah or salmah,) and sometimes ( ;בגדbegedh;)――by the
Greeks, ἱματιον. (himation.) Jahn Archaeologia Biblica. This is the garment which is always
meant by this Greek word in the New Testament, when used in the singular
number,――translated “cloak” in the common English version, as in the passage in the text
above, where Jesus exhorts him that has no sword to sell his cloak and buy one. When this
Greek word occurs in the plural, (ἱματια, himatia,) it is translated “garments,” and it is
noticeable that in most cases where it occurs, the sense actually requires that it should be
understood only of the outer dress, to which I have referred it. As in Matthew xxi. 8, where it
is said that the people spread their garments in the way,――of course only their outer ones,
which were loose and easily thrown off, without indecent exposure. So in Mark xi. 7, 8: Luke
xix. 35. There is no need then, of supposing, as Origen does, that Jesus took off all his
clothes, or was naked, in the modern sense of the term. A variety of other outer garments in
common use both among the early and the later Jews, are described minutely by Jahn in
his Archaeologia Biblica, § 122. I shall have occasion to describe some of these, in
illustration of other passages.
My exegesis on the passage “He that is washed, needs not,” &c. may strike some as
rather bold in its illustration, yet if great authorities are necessary to support the view I have
taken, I can refer at once to a legion of commentators, both ancient and modern, who all
offer the same general explanation, though not exactly the same illustration. Poole’s
Synopsis is rich in references to such. Among these, Vatablus remarks on the need of
washing the feet of one already washed, “scil. viae causa.” Medonachus says of the feet,
“quos calcata terra iterum inquinat.” Hammond says, “he that hath been initiated, and
entered into Christ, &c. is whole clean, and hath no need to be so washed again, all over.
All that is needful to him is the daily ministering of the word and grace of Christ, to cleanse
and wash off the frailties, and imperfections, and lapses of our weak nature, those feet of
the soul.” Grotius says, “Hoc tantum opus ei est, ut ab iis se purget quae ex occasione
nascuntur. Similitudo sumpta ab his qui a balneo nudis pedibus abeunt.” Besides these and
many others largely quoted by Poole, Lampius also (in commentary in Gospel of John) goes
very fully into the same view, and quotes many others in illustration. Wolfius (in Cur.
Philology) gives various illustrations, differing in no important particular, that I can see, from
each other, nor from that of Kuinoel, who calls them “contortas expositiones,” but gives one
which is the same in almost every part, but is more fully illustrated in detail, by reference to
the usage of the ancients, of going to the bath before coming to a feast, which the disciples
no doubt had done, and made themselves clean in all parts except their feet, which had
become dirtied on the way from the bath. This is the same view which Wolf also quotes
approvingly from Elsner. Wetstein is also on this point, as on all others, abundantly rich in
illustrations from classic usage, to which he refers in a great number of quotations from
Lucian, Herodotus, Plato, Terence and Plutarch.
Sift you as wheat.――The word σινιαζω (siniazo) refers to the process of winnowing the
wheat after threshing, rather than sifting in the common application of the term, which is to
the operation of separating the flour from the bran. In oriental agriculture the operation of
winnowing is performed without any machinery, by simply taking up the threshed wheat in a
large shovel, and shaking it in such a way that the grain may fall out into a place prepared
on the ground, while the wind blows away the chaff. The whole operation is well described
in the fragments appended to Taylor’s editions of Calmet’s dictionary, (Hund. i. No. 48, in
Vol. III.) and is there illustrated by a plate. The phrase then, was highly expressive of a
thorough trial of character, or of utter ruin, by violent and overwhelming misfortune, and as
such is often used in the Old Testament. As in Jeremiah xv. 7. “I will fan them with a fan,”
&c. Also in li. 3. In Psalm cxxxix. 2. “Thou winnowest my path,” &c.; compare translation
“Thou compassest my path.” The same figure is effectively used by John the Baptist, in
Matthew iii. 12, and Luke iii. 17.
Galilean pugnacity.――Josephus, who was very familiar with the Galileans by his
military service among them, thus characterizes them. “The Galileans are fighters even from
infancy, and are every where numerous, nor are they capable of fear.” Jewish War, book III.
chapter iii. section 2.
From Jerusalem to Jericho.――The English traveler here referred to, is Sir Frederic
Henniker, who in the year 1820, met with this calamity, which he thus describes in his
travels, pp. 284‒289.
“The route is over hills, rocky, barren and uninteresting; we arrived at a fountain, and
here my two attendants paused to refresh themselves; the day was so hot that I was
anxious to finish the journey, and hurried forwards. A ruined building situated on the summit
of a hill was now within sight, and I urged my horse towards it; the janissary galloped by me,
and making signs for me not to precede him, he rode into and round the building, and then
motioned me to advance. We next came to a hill, through the very apex of which has been
cut a passage, the rocks overhanging it on either side. Quaresmius, (book vi. chapter 2.)
quoting Brocardus, 200 years past, mentions that there is a place horrible to the eye, and
full of danger, called Abdomin, which signifies blood; where he, descending from Jerusalem
to Jericho, fell among thieves. I was in the act of passing through this ditch, when a bullet
whizzed by, close to my head; I saw no one, and had scarcely time to think, when another
was fired some distance in advance. I could yet see no one,――the janissary was beneath
the brow of the hill, in his descent; I looked back, but my servant was not yet within sight. I
looked up, and within a few inches of my head were three muskets, and three men taking
aim at me. Escape or resistance were alike impossible. I got off my horse. Eight men
jumped down from the rocks, and commenced a scramble for me; I observed also a party
running towards Nicholai. At this moment the janissary galloped in among us with his sword
drawn.
“A sudden panic seized the janissary; he cried on the name of the Prophet, and galloped
away. As he passed, I caught at a rope hanging from his saddle. I had hoped to leap upon
his horse, but found myself unable;――my feet were dreadfully lacerated by the honey-
combed rocks――nature would support me no longer――I fell, but still clung to the rope. In
this manner I was drawn some few yards, till, bleeding from my ancle to my shoulder, I
resigned myself to my fate. As soon as I stood up, one of my pursuers took aim at me, but
the other casually advancing between us, prevented his firing; he then ran up, and with his
sword, aimed such a blow as would not have required a second; his companion prevented
its full effect, so that it merely cut my ear in halves, and laid open one side of my face; they
then stripped me naked.
“It was now past mid-day, and burning hot; I bled profusely,――and two vultures, whose
business it is to consume corpses, were hovering over me. I should scarcely have had
strength to resist, had they chosen to attack me. At length we arrived about 3 P. M. at
Jericho.――My servant was unable to lift me to the ground; the janissary was lighting his
pipe, and the soldiers were making preparations to pursue the robbers; not one person
would assist a half-dead Christian. After some minutes a few Arabs came up and placed me
by the side of the horse-pond, just so that I could not dip my finger into the water. This pool
is resorted to by every one in search of water, and that employment falls exclusively upon
females;――they surrounded me, and seemed so earnest in their sorrow, that,
notwithstanding their veils, I almost felt pleasure at my wound. One of them in particular
held her pitcher to my lips, till she was sent away by the Chous;――I called her, she
returned, and was sent away again; and the third time she was turned out of the yard. She
wore a red veil, (the sign of not being married,) and therefore there was something
unpardonable in her attention to any man, especially to a Christian; she however returned
with her mother, and brought me some milk. I believe that Mungo Park, on some dangerous
occasion during his travels, received considerable assistance from the compassionate sex.”
After much more conversation and prayer with his disciples in the
supper-room, and having sung the hymn of praise which usually
concluded the passover feast among the Jews, Jesus went with
them out west of the city, over the brook Kedron, at the foot of the
Olive mount, where there was a garden, called Gethsemane, to
which he had often resorted with his disciples, it being retired as well
as pleasant. While they were on the way, a new occasion happened
of showing Peter’s self-confidence, which Jesus again rebuked with
the prediction that it would too soon fail him. He was telling them all,
that events would soon happen that would overthrow their present
confidence in him, and significantly quoted to them the appropriate
passage in Zechariah xiii. 7. “I will smite the shepherd, and the
sheep shall be scattered.” Peter, glad of a new opportunity to assert
his steadfast adherence to his Master, again assured him that,
though all should be offended, or lose their confidence in him, yet
would not he; but though alone, would always maintain his present
devotion to him. The third time did Jesus reply in the circumstantial
prediction of his near and certain fall. “This day, even this night,
before the cock crow twice, thou shalt deny me thrice.” This repeated
distrustful and reproachful denunciation, became, at last, too much
for Peter’s warm temper; and in a burst of offended zeal, he declared
the more vehemently, “If I should die with thee, I will not deny thee in
any wise.” To this solemn protestation against the thought of
defection, all the other apostles present gave their word of hearty
assent.
They now reached the garden, and when they had entered it,
Jesus spoke to all the disciples present, except his three chosen
ones, saying, “Sit ye here, while I go and pray yonder.” He retired
accordingly into some recess of the garden, with Peter and the two
sons of Zebedee, James and John; and as soon as he was alone
with them, begun to give utterance to feelings of deep distress and
depression of spirits. Leaving them, with the express injunction to
keep awake and wait for him, he went for a short time still farther,
and there, in secret and awful woe, that wrung from his bowed head
the dark sweat of an unutterable agony, yet in submission to God, he
prayed that the horrible suffering and death to which he had been so
sternly devoted, might not light on him. Returning to the three
appointed watchers, he found them asleep! Even as amid the lonely
majesty of Mount Hermon, human weakness had borne down the
willing spirit in spite of the sublime character of the place and the
persons before them; so here, not the groans of that beloved
suffering Lord, for whom they had just expressed such deep regard,
could keep their sleepy eyes open, when they were thus exhausted
with a long day’s agitating incidents, and were rendered still more
dull and stupid by the chilliness of the evening air, as well as the
lateness of the hour of the night; for it was near ten o’clock. At this
sad instance of the inability of their minds to overcome the frailties of
the body, after all their fine protestations of love and zeal, he mildly
and mournfully remonstrates with Peter in particular, who had been
so far before the rest in expressing a peculiar interest in his Master.
And he said to Peter, “Simon! sleepest thou? What! could ye not
watch with me one hour? Watch ye and pray, lest ye enter into
temptation. The spirit indeed is willing, but the flesh is weak.” Well
might he question thus the constancy of the fiery zeal which had so
lately inspired Peter to those expressions of violent attachment.
What! could not all that warm devotion, that high pride of purpose,
sustain his spirit against the effects of fatigue and cold on his body?
But they had, we may suppose, crept into some shelter from the cold
night air, where they unconsciously forgot themselves. After having
half-roused them with this fruitless appeal, he left them, and again
passed through another dreadful struggle between his human and
divine nature. The same strong entreaty,――the same mournful
submission,――were expressed as before, in that moment of solitary
agony, till again he burst away from the insupportable strife of soul,
and came to see if yet sympathy in his sorrows could keep his
sleepy disciples awake. But no; the gentle rousing he had before
given them had hardly broken their slumbers. For a few moments the
voice of their Master, in tones deep and mournful with sorrow, might
have recalled them to some sense of shame for their heedless
stupidity; and for a short time their wounded pride moved them to an
effort of self-control. A few mutual expostulations in a sleepy tone,
would pass between them;――an effort at conversation perhaps,
about the incidents of the day, and the prospect of coming danger
which their Master seemed to hint;――some wonderings probably,
as to what could thus lead him apart to dark and lonely
devotion;――very likely too, some complaint about the cold;――a
shiver――a sneeze,――then a movement to a warmer attitude, and
a wrapping closer in mantles;――then the conversation languishing,
replies coming slower and duller, the attitude meanwhile declining
from the perpendicular to the horizontal, till at last the most wakeful
waits in vain for an answer to one of his drowsy remarks, and finds
himself speaking to deaf ears; and finally overcome with impatience
at them and himself, he sinks down into his former deep repose, with
a half-murmured reproach to his companions on his lips. In short, as
every one knows who has passed through such efforts, three sleepy
men will hardly keep awake the better for each other’s company; but
so far from it, on the contrary, the force of sympathy will increase the
difficulty, and the very sound of drowsy voices will serve to lull all the
sooner into slumber. In the case of the apostles too, who were
mostly men accustomed to an active life, and who were in the habit
of going to bed as soon as it was night, whenever their business
allowed them to rest, all their modes of life served to hasten the
slumbers of men so little inured to self-control of any kind. These
lengthy reasons may serve to excite some considerate sympathy for
the weakness of the apostles, and may serve as an apology for their
repeated drowsiness on solemn occasions; for a first thought on the
subject might suggest to a common man, the irreverent notion, that
those who could slumber at the transfiguration of the Son of God on
Mount Hermon, and at his agony in Gethsemane, must be very
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com