RasPi Magazine 13.pdf

(17557 KB) Pobierz
ESIGN
D
UILD
B
CODE
13
WHY YOU NEED
AirPlay
Speakers
Set up
Plus
Make a digital photo frame
Welcome
The big focus this month is
Python 3. You see, despite the
fact that vast numbers of us
code in the deprecated Python
2.7, we do need to switch to the more modern
yet often neglected version of the language.
One of the biggest reasons is the upcoming
end-of-life date for Python 2.7, and the fact
that the devs are very clear about there not
being a version 2.8. So it’s time to get up to
speed, and this month we give you a flying
start. Sticking with the Python theme, we’re
also looking at how to optimise your code to
make it run faster on the Pi. Plus, we have
a cool selection of projects for you to try out
this weekend, too – including a digital photo
frame and a wireless stereo system. Enjoy!
Get inspired
Discover the RasPi
community’s best projects
Expert advice
Got a question? Get in touch
and we’ll give you a hand
Easy-to-follow
guides
Learn to make and code
gadgets with Raspberry Pi
Editor
From the makers of
Join the conversation at…
@linuxuse
@linuxusermag
Li
Linux User & Developer
U
D l
Develope
RasPi@imagine-publishing.co.uk
Contents
Why you need Python 3
It’s time to finally make the switch
PiKon
Shooting the Moon with a 3D-printed telescope
Make a digital photo frame
Combine signage software with the HDMIPi
What are the extra GPIO pins?
How did they improve on the original models?
Set up a wireless AirPlay speaker
Expand it into a full stereo system for your house
Remotely control your Pi
Use a web interface to connect instead of SSH
Optimising code for your Pi
Profile your code to figure out the slow spots
Talking Pi
Your questions answered and your opinions shared
Why you need Python 3
Bring your programming skills up to date by finally
letting go of Python 2 and embracing
the better language
Python 3 has been languishing. There have
been many good reasons for this, including a
lack of dependencies, monolithic code bases
written in Python 2 that are costly to port across, and
also the prevalence of tutorials such as those found in
this magazine that continue to focus on the outdated 2.x
versions, among many other reasons. One of the common
threads uniting all these reasons not to use Python 3
is a sense that there aren’t enough people actually
programming in Python 3 to help spread its adoption. A
few years ago (we’ve had Python 3 for seven now), things
like the lack of dependencies were real inhibiting factors,
but the situation has vastly improved since then and some
of these reasons just don’t hold up any more.
So why haven’t people switched yet? Part of the
problem is perhaps down to the dual support of both
Python 2 and Python 3 by its developers, but in any case
there is no real reason nowadays to continue writing code
in the deprecated version of Python. Momentum is needed
from the community in order to successfully make the leap
from Python 2 to the much, much better Python 3, and to
ensure that Python isn’t abandoned altogether in favour of
Ruby or Go, for example.
The adoption of Python 3 by the community is
something that we personally believe in here at
RasPi
and,
since we regularly write Python tutorials for you, it makes
sense for us practise what we preach. We won’t throw you
into the deep end immediately, but over the coming months
we are going to begin transitioning across to using Python
3 ourselves. When you download your tutorial assets each
issue, keep an eye out for the Python 3 files that we’ll be
adding. For now, though, read through our Python 3 primer
and we’ll get you started with this fantastic programming
language today.
“Momentum
is
needed from
the community
in order to
successfully
make the leap
from Python
2 to the much,
much better
Python 3”
Zgłoś jeśli naruszono regulamin