(Ebook) Programming with Python for Social Scientists by Phillip Brooker ISBN 9781526431714, 1526431718 2024 scribd download
(Ebook) Programming with Python for Social Scientists by Phillip Brooker ISBN 9781526431714, 1526431718 2024 scribd download
com
https://ebooknice.com/product/programming-with-python-for-
social-scientists-11380882
DOWLOAD EBOOK
ebooknice.com
https://ebooknice.com/product/prototyping-python-dashboards-for-
scientists-and-engineers-55888336
ebooknice.com
https://ebooknice.com/product/beginning-programming-with-python-for-
dummies-33181626
ebooknice.com
ebooknice.com
(Ebook) C Programming for Scientists and Engineers with
Applications by Rama Reddy, Carol Ziegler ISBN
9780763739522, 0763739529
https://ebooknice.com/product/c-programming-for-scientists-and-
engineers-with-applications-51638612
ebooknice.com
https://ebooknice.com/product/inferno-programming-with-limbo-2186566
ebooknice.com
https://ebooknice.com/product/programming-interview-problems-dynamic-
programming-with-solutions-in-python-22295810
ebooknice.com
ebooknice.com
https://ebooknice.com/product/beginning-programming-with-python-for-
dummies-3rd-edition-58997908
ebooknice.com
Programming with Python for social scientists
2
3
Programming with Python for social scientists
Phillip D. Brooker
Los Angeles
London
New Delhi
Singapore
Washington DC
Melbourne
4
SAGE Publications Ltd
1 Oliver’s Yard
55 City Road
London EC1Y 1SP
SAGE Publications Inc.
2455 Teller Road
Thousand Oaks, California 91320
SAGE Publications India Pvt Ltd
B 1/I 1 Mohan Cooperative Industrial Area
Mathura Road
New Delhi 110 044
SAGE Publications Asia-Pacific Pte Ltd
3 Church Street
#10-04 Samsung Hub
Singapore 049483
© Phillip Brooker 2020
First published 2020
Apart from any fair dealing for the purposes of research or private study,
or criticism or review, as permitted under the Copyright, Designs and
Patents Act, 1988, this publication may be reproduced, stored or
transmitted in any form, or by any means, only with the prior permission
in writing of the publishers, or in the case of reprographic reproduction, in
accordance with the terms of licences issued by the Copyright Licensing
Agency. Enquiries concerning reproduction outside those terms should be
sent to the publishers.
Library of Congress Control Number: 2019944187
British Library Cataloguing in Publication data
A catalogue record for this book is available from the British Library
ISBN 978-1-5264-3171-4
ISBN 978-1-5264-3172-1 (pbk)
Editor: Jai Seaman
Editorial assistant: Lauren Jacobs
Assistant editor, digital: Sunita Patel
Production editor: Ian Antcliff
Copyeditor: Richard Leigh
Proofreader: Neville Hankins
Indexer: Elizabeth Ball
Marketing manager: Susheel Gokarakonda
5
Cover design: Shaun Mercier
Typeset by: C&M Digitals (P) Ltd, Chennai, India
Printed in the UK
At SAGE we take sustainability seriously. Most of our products are printed
in the UK using responsibly sourced papers and boards. When we print
overseas we ensure sustainable papers are used as measured by the PREPS
grading system. We undertake an annual audit to monitor our
sustainability.
6
Contents
1. About the Author
2. Preface
3. Acknowledgements
4. Your Online Resources
5. PART ONE UNDERSTANDING PROGRAMMING
1. 0 Introduction
2. 1 What Is Programming? And What Could it Mean for Social
Science Research?
3. 2 Programming-as-Social-Science (Critical Coding)
6. PART TWO BASIC PYTHON GRAMMAR, SYNTAX AND
CONCEPTS
1. 3 Setting Up to Start Coding
2. 4 Core Concepts/Objects
3. 5 Structuring Objects
4. 6 Building Better Code with (Slightly) More Complex
Concepts/Objects
5. 7 Building New Objects with Classes
6. 8 Useful Extra Concepts/Practices
7. PART THREE WORKING WITH PYTHON
1. 9 Designing Research That Features Programming
2. 10 Working with Text Files
3. 11 Data Collection: Using Social Media APIs
4. 12 Data Decoding/Encoding in Popular Formats (CSV, JSON
and XML)
5. 13 Data Collection: Web Scraping
6. 14 Visualising Data
8. PART FOUR PROGRAMMING-AS-SOCIAL-SCIENCE
1. 15 Conclusion: Using Your Programming-as-Social-Science
Mindset
9. References
10. Index
7
Extended Contents
1. About the Author
2. Preface
3. Acknowledgements
4. Your Online Resources
5. PART ONE UNDERSTANDING PROGRAMMING
1. 0 Introduction
1. Who Is This Book for? Why This Book?
2. Why Python? Why Python 3?
3. “Grilled Cheese Programming”: A Methodology, A
Manifesto
4. Aims, Scope, Outcomes and Overview of the Book
2. 1 What Is Programming? And What Could it Mean for Social
Science Research?
1. Defining Our Terms
2. The Research Process as a Socio-technical Assemblage
3. Working Interdisciplinarily
4. Thinking in Script/Developmental Workflows
3. 2 Programming-as-Social-Science (Critical Coding)
1. Coding Social Injustice and Justice into the World
2. Ethical Considerations of Programming as Social Science
3. What Can/Should We Do with Python?
4. Summary of Part One
6. PART TWO BASIC PYTHON GRAMMAR, SYNTAX AND
CONCEPTS
1. 3 Setting Up to Start Coding
1. Getting Started with Python
2. Commenting
2. 4 Core Concepts/Objects
1. Variables
2. Mathematical Operations and Comparison/Equality
3. Flow Control (and Whitespace)
3. 5 Structuring Objects
1. Lists and List Methods
2. Tuples and Tuple Methods
3. Dictionaries and Dictionary Methods
4. Strings and String Methods
4. 6 Building Better Code with (Slightly) More Complex
Concepts/Objects
1. Functions
8
2. Loops and List Comprehension
5. 7 Building New Objects with Classes
1. Classes
6. 8 Useful Extra Concepts/Practices
1. Installing Modules
2. Importing Modules
3. Timing Your Code
4. Creating Script Interfaces with Inputs
5. Commenting and Documenting Code Effectively
6. Summary of Part Two
7. PART THREE WORKING WITH PYTHON
1. 9 Designing Research That Features Programming
1. Design as a Social Scientific Activity
2. Practicalities
2. 10 Working with Text Files
1. Show Me the Code!
2. Some Possible Applications/Projects
3. 11 Data Collection: Using Social Media APIs
1. Getting Your Authentication Credentials
2. Show Me the Code!
3. Some Possible Applications/Projects
4. 12 Data Decoding/Encoding in Popular Formats (CSV, JSON
and XML)
1. Show Me the Code! Reading from the Web
2. Show Me the Code! CSV Data
3. Show Me the Code! JSON Data
4. Show Me the Code! XML Data
5. Some Possible Applications/Projects
5. 13 Data Collection: Web Scraping
1. Show Me the Code! Doing Detective Work in HTML
2. Show Me the Code! Web Scraping with BeautifulSoup
3. Some Possible Applications/Projects
6. 14 Visualising Data
1. Show Me the Code! Pandas
2. Show Me the Code! Matplotlib
3. Some Possible Applications/Projects
4. Summary of Part Three
8. PART FOUR PROGRAMMING-AS-SOCIAL-SCIENCE
1. 15 Conclusion: Using Your Programming-as-Social-Science
Mindset
9
1. A Few Final Points
2. Reflecting on What We’re Doing When We’re Doing
Programming-as-Social-Science
9. References
10. Index
10
About the Authors
Phillip Brooker
is a Lecturer in Sociology at the University of Liverpool, with
interdisciplinary research interests in and around ethnomethodology
and conversation analysis, science and technology studies, Computer-
Supported Cooperative Work, and human–computer interaction. On
the platform of a record of research in the emerging field of digital
methods and social media analytics (having contributed to the
development of a Twitter data collection and visual analysis package
called Chorus (http://www.chorusanalytics.co.uk)), his current
research interests lie in exploring the potential for computer
programming to feature in core social science research methods
training. He also convenes the Programming-as-Social-Science
(PaSS) network (http://www.jiscmail.ac.uk/PaSS).
11
Preface
In 2002, I enrolled at a college near my home town and, like every student
enrolling that year, I was brought into the dean’s office for a brief
discussion of my A/S- and A-level choices: sociology, history, English
literature and music. I was very much looking forward to studying all four
of them. The dean’s first comment to me was to say that he was concerned
by my choice to hone in exclusively on the arts and humanities – looking
over my GCSE transcripts, he noted that I’d done fairly well in things like
science and IT, and advised me that if I didn’t pick up at least one course
in science or computing at college, I’d never have the chance to study
anything like that again. Not at university, not in a graduate job, not in a
career, not ever. Even though this little 5-minute interaction took place
half a lifetime ago, I vividly remember being shaken by the prospect of
having a whole swathe of options closed down for ever. That kind of thing
is a lot for a 16-year-old to have to deal with, especially within the scope
of a 5-minute appointment. As I sat there in the dean’s office, my brain
couldn’t handle a quick but comprehensive reconsideration of what I
wanted to do with the rest of my life, so I stuck with my choices and
walked out of the dean’s office having enrolled to study sociology, history,
English literature and music. However, trepidation and worry had replaced
my earlier excitement.
Since getting those A-levels (and enjoying the courses!) and going on to
university to study sociology at various levels I have, rather unexpectedly,
ended up doing research across a variety of fields including science and
technology studies, the sociology and philosophy of scientific knowledge
and research, human–computer interaction, and Computer-Supported
Cooperative Work. Some of my more recent work has been in social
media analytics – a relatively new area of social science based on
exploring collections of user-generated data from places like Twitter or
Instagram – and specifically around the development of innovative digital
methods which social scientists can use to study those topics. All of this
has culminated in my having to teach myself Python, as a tool that is now
integral to my research and which helps me get a handle on the digital data
I need to work with.
So, on a daily basis, throughout my university studies and my academic
career, I have found myself doing things that the college dean told me I
couldn’t possibly ever do. The reason I’m writing this potted history of
myself is not for any kind of self-aggrandisement (though admittedly it’s
pretty satisfying to stick two fingers up at the college dean who very
12
nearly convinced me not to study the things I was passionate about
learning). Infinitely more important than that is that I demonstrate that
computer programming is not outside of the scope of what you, as a social
scientist, can learn, if you find a need to do so. As a student and
practitioner of the social sciences, you’re already a smart, engaged, critical
thinker – if you weren’t, you wouldn’t be interested in social science! –
and this book is about complementing those existing skills with Python
programming as a new tool that will help you extend your reach into new
topics and new forms of social research. In that sense, the key goals of this
book are not just to teach you the mechanics of how to write out Python
code, but to show you how you might apply your existing social scientific
skills to thinking about the role of programming and software in research
and in society generally.
I also want to acknowledge the enormous debt my own learning of Python
– in fact, my learning of all that I know in the social sciences – owes to the
sociologically affiliated field of ethnomethodology. As a discipline which
is premised on understanding how social life operates from the perspective
of those living it, ethnomethodology has enabled me to dive right into the
things that have interested me, including how scientists use computer
programming to do their work, how people collaboratively use computer
software across various different activities, how to help build software
tools that address the needs of Digital Social Science researchers, how to
understand the ways in which people interact with and through the internet
and social media as part of their daily lives, and more. Moreover,
ethnomethodology has encouraged (and in fact required) me to engage
directly with the things that the people being studied do when they are
using computer technologies as part of their activities – to get first-hand
experience of how they do these things by learning to do them myself. In
short, ethnomethodology is how I learned to do programming. And as a
result, this idea of learning and doing Python ethnomethodologically is the
core pedagogical device of this book too. In the hopes of aping David
Sudnow, the ethnomethodologist whose studies of learning to play jazz
piano resulted in the acclaimed Sudnow Method of jazz piano tuition, my
ethnomethodologically grounded studies of computer usage and
programming feed directly into this attempt to transmit those knowledges
and skills to others. It is on these grounds that I wholeheartedly encourage
readers to seek out ethnomethodological literature, to attend courses,
seminars and conferences on it, to speak to their lecturers about it, and to
use it as a background to their own social scientific endeavours.
Phillip Brooker
13
Acknowledgements
My original acknowledgements section overran into about three pages
which, though unfortunately too unwieldy, is indicative of how lucky and
privileged I am to have had the benefit of support from so many people
throughout the process of researching and writing this book. Though it’s
sadly not possible to reproduce a full list of names here (and though the
acknowledgments that follow barely scratch the surface of what is
deserved), my sincerest thanks go out to the following:
The various scholars affiliated with Manchester’s ethnomethodology
research community, all of whom have contributed immeasurably to
the thinking that underpins this book (and indeed all of my work).
All of the social media analytics/human–computer interaction people
I have worked for and with as a postdoc across Brunel, Bath and
Newcastle/Northumbria Universities. I would hope that the influence
you have had on this book is patently obvious; it is certainly very
much appreciated.
My colleagues in Liverpool’s Department of Sociology, Social Policy
and Criminology; I couldn’t wish for a better or more supportive
group of people to work with. Aside from everything else (and there
is lots for me to be thankful for here!), you’ve all been so incredibly
polite as I bore you to death about coding and bots and Raspberry Pi
computers and so on, which is no mean feat.
The editorial team and various other staff at SAGE who I have been
involved with over the last few years – your input, guidance and
advice have always been invaluable and very much appreciated.
Finally, I’d like to directly thank Wes Sharrock (for reasons that will
be obvious to anyone who is lucky enough to know Wes), and
Michelle, Noah and The Little Pea (for being Michelle, Noah and The
Little Pea).
14
Your Online Resources
Visit https://study.sagepub.com/brooker
15
Part one Understanding programming
16
Part One contents
Chapter 0: Introduction 3
Chapter 1: What is Programming? And What Could it Mean for
Social Science Research? 19
Chapter 2: Programming-as-Social-Science (Critical Coding) 37
17
Part One objectives
To set out the scope of this book in terms of what you can expect to
learn from reading it (and, of course, doing the exercises!).
To define some key terms and concepts we will be using as we go
forward.
To begin to think about “Programming-as-Social-Science” as a
unique approach to understanding the world which integrates
(unsurprisingly) Python programming techniques with the work of
social science.
Welcome to the book! Part One intends to get everybody on the same page
and kick us off by outlining all of the core stuff of computer programming,
and why we might be interested in learning how to program as social
scientists. We’ll be asking and answering questions going right back to “so
what is computer programming anyway?”, as well as figuring out ways of
looking at and using programming that are helpful and valuable to us as
social scientists. This is going to form the background to the later chapters
where we’re learning about how to read and write Python computer code –
the things we cover here aim to give context to what you’re learning later.
So, while Part One doesn’t directly deal with the mechanics of how the
Python programming language works, it is still really useful in terms of
keeping our focus not just on the idea of programming as an instrumental
means-to-an-end type of deal, but thinking about programming in such a
way that it can be leveraged for social scientific purposes.
Let’s get to it!
18
0 Introduction
Who Is This Book for? Why This Book? 6
The design of the book 7
Why not digital-methods-for-social-science literature? 8
Why not existing computer-programming-for-beginners
literature? 9
Why Python? Why Python 3? 10
What can Python do? 11
What can Python 3 do? 12
“Grilled Cheese Programming”: A Methodology, A Manifesto 13
Social science requirements for programming 14
Aims, Scope, Outcomes and Overview of the Book 15
Aims and objectives 15
Scope 15
Learning outcomes 16
Overview 16
19
Chapter objectives
To outline what computer programming is, and why a social scientist
might be interested in learning how to do it.
To state the position of this book among other available instructional
literature on both computer programming and digital methods.
To establish a basis for a specifically social scientific approach to
programming – “Grilled Cheese Programming” – which is sensitive
to our needs and requirements.
Both “social science” and “computer programming” are slippery terms that
cover a lot of diverse topics and research practices. This makes it difficult
to pin a date on when either can be said to have started. But by any
measure, both have been around for a long time. Arguably, modern social
science emerged out of the Enlightenment period in Europe in the mid-
seventeenth century, with figures such as Thomas Hobbes and John Locke
producing work on philosophy, morality and politics that went on to
inform the more explicitly proto-sociological developments of eighteenth-
and nineteenth-century thinkers like Adam Smith, Henri de Saint-Simon
and Auguste Comte. Perhaps surprisingly, given how we might think of
computers being a relatively recent technological development, it’s
generally agreed that the computer program can be dated as far back as
1843, with Ada Lovelace’s creation of the first algorithm which formalised
a set of instructions for computing a sequence of “Bernoulli numbers” to
be carried out via Charles Babbage’s (then designed but unbuilt)
“Analytical Engine”.
But despite the fact that both social science and computer programming
are long-standing enterprises, it’s only far more recently that academics
have begun to explore how the two might be combined. Social science –
especially those areas of it that focus on topics where collaboration is
inevitable, such as human–computer interaction and Computer-Supported
Cooperative Work – has already produced more than a few studies of the
work of programming (see the further reading section below). In these
studies, the focus has been on the social aspects of how programmers
manage their working together: how the work of programming gets done
by programmers. However, doing a study of computer programming is not
quite the same as using computer programming to do a social scientific
study – why is it that we’re only now starting to think about what
computer programming might offer as a tool and skill for social scientists?
Further reading
20
Social Studies of Programming
Graham Button and Wes Sharrock’s mid-1990s works in the field of
Computer-Supported Cooperative Work are great examples of the
kinds of interest and approach a social science researcher might bring
to studying programming as an activity:
Button, G. and Sharrock, W. (1994) Occasioned practices in the work
of software engineers. In M. Jirotka and J. Goguen (eds),
Requirements Engineering: Social and Technical Issues. London:
Academic Press, pp. 217–240.
Button, G. and Sharrock, W. (1995) The mundane work of writing
and reading computer programs. In P. Ten Have and G. Psathas (eds),
Situated Order: Studies in the Social Organisation of Talk and
Embodied Activities (Studies in Ethnomethodology and Conversation
Analysis No. 3). Washington, DC: University Press of America, pp.
231–258.
The shift is largely motivated by the fact that digital data and the internet
as a site of everyday social interaction have significantly changed the
playing field of the social sciences. Within this emerging field of “Digital
Social Science”, both the topics and methods associated with social
science research have become increasingly computer-oriented. As people
interested in studying social life, we can’t ignore that a lot of what people
get up to in everyday society is organised around and through the use of
things like computers, the internet, search engines, entertainment-
streaming services, social media, smartphone apps, and so on. This is
hugely important across the whole of social science; as Housley et al. note,
focusing on the digital world offers social science the potential not only to
extend its reach into new forms of sociality, but also to deepen our
understanding of existing forms: “these technologies and their allied data
have the potential to ‘digitally-remaster’ classic questions about social
organization, social change and the derivation of identity from collective
life” (2014: 4). Moreover, if we want to find out about any of these things
as social scientists, we will inevitably have to draw on a variety of digital
tools and methods to do so. Even ethnography, a method more typically
associated with the physical presence of a researcher within a participant’s
setting, is not exempt from these effects; as Hallett and Barber (2014: 308)
note, ethnographic researchers “need to reconceptualize what counts as a
field site … studying a group of people in their ‘natural habitat’ now
[often] includes their ‘online habitat’”. So, engaging with computational
and digital tools and data has already become integral to what social
21
scientists do. This book seeks to extend that thinking and demonstrate
(among other things) that learning how to program can significantly
enhance how social scientists can think about their studies, and especially
those premised on the collection and analysis of digital data.
Definitions
Digital Social Science/Computational Social
Science
To say there is a single field called “Digital Social Science” is a bit
misleading – in reality, this term is so broad as to cover lots of
different, constantly shifting forms of philosophical orientations,
disciplinary commitments, research approaches, topics and methods.
So I’ll use the term “Digital Social Science” in an intentionally very
loose way which doesn’t make any kind of futile attempt to unify all
of these things, but which still serves as a shorthand for any kind of
research that somehow involves using digital tools and methods
(whatever those may be) to explore digital topics (whatever those
may be!).
However, just because you might see the term used elsewhere, it is
worth noting that there does already exist a specific area of inquiry
called “Computational Social Science” which seeks to take a
scientifically systematic approach to the application of tools like
programming to social science problems and questions (cf. González-
Bailón, 2013; Lazer et al., 2009; Nelson, 2017). However, the
approach I’m presenting here (programming as social science)
slightly diverges from the scientifically systematic orientation of
Computational Social Science for reasons explained in Chapter 2, so
for practical purposes and ease of reference, this body of work will
fall under the term “Digital Social Science” throughout.
However, the point of this book is not (just) to provide social scientists
with an introduction to the mechanics of the Python programming
language – such introductions are already available across lots of books
and websites (though few are tailored to the specific needs of social
scientists as this book is). Nor is it to suggest that social scientists need to
adopt programming as a way of “formalising”, “mathematising” and/or
“automating” their work, as if such things were even possible – see
Section 1.2 for fuller details of the issues surrounding these ideas. Indeed,
arguments against scientism (i.e. the idea that our work should operate
more like the natural sciences of physics and chemistry) and the
bureaucratisation of social science (i.e. the transformation of our work into
22
a purely technical non-interpretive “number-crunching” exercise) have
been a defining characteristic of influential thinking about the role and
purpose of social science, from Wittgenstein (2009 [1953]) and C. Wright
Mills (2000 [1959]) to Button et al. (1995) and Savage and Burrows
(2007). The strength of the social sciences has always been in their
resistance to scientism and bureaucratisation, and in this sense, this book
emphatically does not approach programming as a way of “upskilling”
social science or reifying computer science/scientists as a gold standard to
strive towards. We are already very skilled at what we do, and no amount
of computing power or speed could possibly compete with our human
capacity for critical thinking, for methodological reflexivity, for generating
critiques and counter-narratives, for motivating social change and
activism, and so on.
Rather, the point of this book is to show how the work of programming
can fit into and enhance the skillsets and knowledges we already have, and
in doing so bring about a uniquely social scientific approach to
programming as a research method (we’ll go on to call this
“Programming-as-Social-Science”, or PaSS for short) that we can leverage
to do the work we want to do, in ways that we want to do it. The remainder
of this book can be read as an elucidation of this central theme.
23
0.1 Who Is This Book for? Why This Book?
There are short answers to the above questions. Who is this book for? It’s
probably no surprise that the intended audience of a book called
Programming with Python for Social Scientists is social scientists who
want to learn to program. In Python. And why this book? That can be
boiled down to the following statements:
1. Social science digital methods resources don’t typically cover
programming. This makes it difficult to think about the practical
aspects of doing Digital Social Science work, and it limits our
capacity to be reflexive about our methods and methodologies when
we use software tools developed by others.
2. Python programming resources, on the other hand, don’t speak to the
requirements of social science, and this makes it difficult to see how
the general-purpose/abstract knowledge and skills transmitted through
those resources can fit into the work we are trying to do.
3. The value of this book is that it handles both social science and
computer programming simultaneously – it demonstrates Python as a
social science research toolkit and walks through some examples of
those tools in use in social-science-relevant tasks, but also shows you
how to think about programming as a research method more widely.
24
with data, look at data” narrative. However, I want to be really clear that
the overarching aim of this book is not to delimit the scope of Python by
suggesting its potential can be exhausted across one volume; Python is an
open-ended and evolving toolkit, which makes the possibilities for its
application and usage endless. In outlining the very basics of just a few
potential applications, the aim is to engender a “programming mindset”
(see Chapter 15) in readers, which can then be applied to their own
programming activities whatever they may be. The materials provided in
this book will form the foundations for these activities, but the most
interesting stuff will happen when you take your “programming mindset”
forward into your own projects.
The design of the book
The materials covered in this book are designed for a range of skills,
abilities and career stages from advanced (year 3-ish) undergraduates
looking to learn techniques for research-oriented assessments, right
through to professional researchers seeking to develop methodologies and
methods that will help them dig into Digital Social Science more deeply.
The book as a whole is designed and structured in a modular way such that
although it unfolds in a linear fashion (with chapters building from
introductory content on programming in general, to more specific outlines
of Python techniques, to applications of those techniques in research-
relevant contexts), each chapter also provides useful reference material to
which readers may wish to return at various points in their programming
activities. Readers with absolutely no familiarity with programming will
be able to work from basic concepts (e.g. Chapters 1–4, which establish
the foundational ideas of what programming can offer social science and
provide reference material on key Python concepts) and thereby build
towards the more advanced skills and techniques outlined in later chapters.
Readers who may already have more grounding in programming (or who
have previously been through this book!) can dip into individual chapters
to address specific skills and techniques they may wish to develop (e.g.
Chapters 5–12, which are about substantive topics with a direct Digital
Social Science research relevance), using earlier chapters as reference
material to refresh their memories where required.
So that’s who this book has been designed for – Digital Social Science
practitioners (from undergrad to professional) whose work might be
enhanced by a better understanding of programming in terms of not only
how to write and work with Python, but also how to think about
programming and software as part of the research process and part of
society generally. But a question remains: why this book in particular?
25
Why not digital-methods-for-social-science
literature?
As noted above, social scientists are now inevitably having to engage with
computational issues as part of their day-to-day work, whether that’s as a
topic of study (i.e. people interacting and doing social life online) or as a
method and means of working with digital resources relevant to social
science concerns (e.g. using software to extract and visualise such things
as social media data corpora, publicly available government datasets, or
the WikiLeaks archive). This has resulted in an emerging body of work on
“digital methods”, designed to help social science students and researchers
think about digital data and the digital world by exploring the conceptual,
methodological, philosophical and ethical aspects of digital data from a
specifically social science perspective. These books and journal articles (a
selection of which feature in the further reading section below) give a great
introduction to various methodological ideas around the use of digital data,
such as its politicisation, its commercialisation, how such methods might
sit alongside theoretical ideas already in play in the social sciences, how to
combine “offline” and “online” methods – for example, through new
syntheses such as Kozinets’s (2010) “netnography” – and so on. However,
these materials only offer a one-way understanding of digital technologies:
they demonstrate how to draw on things that are already available (like
Google search results, or Twitter hashtag conversations, or comments on a
Facebook page, or blog posts on a particular topic of interest) to make
social scientific sense of them.
Further reading
Digital Methods
In reality, nobody really agrees on a set of defined methodological
principles for undertaking work with digital data (not that there are
many that agree on this in the “traditional” social sciences either!).
However, the following resources are good starting-points for
thinking about some key methodological issues within the context of
digital data:
Brügger, N. and Finneman, N.O. (2013) The web and digital
humanities: Theoretical and methodological concerns. Journal of
Broadcasting and Electronic Media, 57(1), 66–80.
Kozinets, R.V. (2010) Netnography: Doing Ethnographic Research
Online. Los Angeles: Sage.
Matthews, N. and Sunderland, N. (2013) Digital life-story narratives
as data for policy makers and practitioners: Thinking through
26
methodologies for large-scale multi-media qualitative datasets.
Journal of Broadcasting and Electronic Media, 57(1), 97–114.
Rogers, R. (2013) Digital Methods. Cambridge, MA: MIT Press.
Tufekci, Z. (2014) Big questions for social media Big Data:
Representativeness, validity and other methodological pitfalls. In
Proceedings of the Eighth International AAAI Conference on
Weblogs and Social Media, Ann Arbor, Michigan, USA, 1–4 June
2014. Palo Alto, CA: AAAI Press, pp. 505–514.
Of course, this approach is very interesting in its own right and has yielded
some really insightful studies. However, it is not especially common for
these methodological studies to go into much detail on the practical
aspects of how to gather and work with these kinds of digital data – for
instance, it’s one thing to talk about the principle of using Instagram
pictures as data, but how are you supposed to actually get hold of a dataset
of images? And how are you supposed to organise and filter such a
potentially enormous dataset to make sure you’re looking at the bits of
data that are actually relevant to your project? And what exactly are you
supposed to do with those data (other than just vaguely poke your way
around some files and think about them) to get yourself to a point where
some interesting insights have resulted? This is the kind of thing that can
be done quite straightforwardly if you have computer programming skills.
But digital methods resources don’t typically cover the practicalities of
doing research with digital data, and this can make it very difficult to see
how we can even begin to engage with such research as social scientists.
Moreover, being able to answer these questions is often just as important
as the analyses that result from our research, in terms of our need to reflect
on and explain our methods and our research process (as we will explore
in more detail in Section 1.2). So overall, it would be helpful to be shown
how to do this kind of work on a practical level, and resources that can
help you learn computer programming would give you the tools you need
to be able to do that. However, that’s not the kind of thing you can find out
from existing social science resources on digital methods.
Why not existing computer-programming-for-
beginners literature?
There are textbooks and other resources for teaching computer
programming to complete beginners, and specifically there are lots that
aim to give learners a background in the core concepts of Python and in
useful applications of it. Some resources teach Python in an abstract
manner, focusing on teaching the mechanics of the language without
27
reference to real-world problems. These types of resources are great for
just learning the basics of Python, though it’s often perhaps difficult to see
how you might apply that learning to the things you want to be able to do
with computer programming (as in, you might then ask the question,
“Great, so I know what all these bits and pieces of Python grammar and
syntax do – now what?”). Which is exactly why some other resources are
more organised around teaching Python in an applied manner, focusing on
building programs for specific jobs (e.g. organising large batches of files,
extracting text from PDF files, or editing images). But again, it might be
difficult to see how you apply these particular skills to your social science
research projects (as in, you might then ask the question, “Great, so I know
how to organise large batches of files, but how does that help me with my
discourse analysis of Instagram pictures of the Scottish Referendum,
beyond the technical exercise of organising my large batch of Instagram
pictures?”). Both of these types of resources are great for teaching the raw
skill of using Python in a general-purpose way for a wide audience.
However, what these resources do not do is recognise the requirements
that social scientists have of their research tools1 – chiefly, that it is not
enough to simply be able to use a skill (like programming) in abstract or
even to do specified tasks which we might find useful. We need also to be
able to think critically about the impact that that skill has on the problems
we are trying to work on, and to think about how that skill intersects with
the philosophical, conceptual, theoretical and methodological positions our
work might embody – in short, how computer programming and code
itself are social practices embedded in the social world. It is, then, not
much help to us to be taught how to program in the ways that these two
types of resources attempt (i.e. via drills that are disconnected from real-
world problems, or via real-world but non-social-science problems). We
need instead to learn programming in ways which can also help us ask and
answer deeper questions around the status of the topics we are applying
programming to and the research processes we undertake to do that.
Moreover, we need to learn programming in a way which allows us to
think about its potential role and status as a research tool beyond the
examples of its application.
1 I mean, they don’t attempt to do this, so it feels a bit unfair to call them
out on it. But nonetheless, the point still stands in terms of why you’re
reading this book right now.
Hence, while this book has elements of both of the types of resource
outlined above – there is reference material on the grammar and syntax of
Python, as well as more detailed chapters on how to apply those concepts
28
to specific (social-science-relevant) tasks – all of the material covered is
underpinned by a overriding concern with using your programming
mindset as a social scientist. This is what will help you use Python
programming beyond the scope of what is featured in this book; as a
research method – not just a raw skill – about which you are able to think
critically reflexively and social-scientifically.
0.2 Why Python? Why Python 3?
So now we’ve settled it: if you’re a social science researcher looking to
engage with digital data or other such computational issues, you’re in the
right place. But there are lots of programming languages out there, so why
should we focus specifically on Python? And why, even more specifically,
on Python version 3?
To answer these questions, we should take a little step back and think
about what a programming language actually is. In essence, a
programming language is a collection of tools which allow a human user
to manipulate the physical hardware of a computer. It’s the same sort of
principle as when you are using a calculator to do a sum – you type in
instructions for the sum you want calculating, those instructions tell the
calculator how to translate that into mechanical operations, the calculator
performs those mechanical operations (crudely, it switches various
transistors on and off), and it then translates the results of those operations
back into a human-friendly format (i.e. numbers) to feed back to you the
answer to your sum. However, we should also recognise that the
“programming language” we use to do sums on a calculator is very strictly
defined. The calculator only accepts certain types of input – it accepts
numbers, connected by mathematical operators, and an equals sign to
signify that your instructions have ended. Moreover, the results it produces
are just as strictly defined. You won’t ever get anything other than a
numerical result out of a calculator, no matter what instructions you put
in.2 This is where programming languages are far more powerful than just
being calculators – you have far greater expressive control over the format
of your input into a programming language, and the formatting of the
results is also pretty much limitless – you can use a programming language
to do anything from simple calculations to enabling sophisticated analyses
of digital data, running a Twitter bot, controlling the movements of a
physical robot, or having your Internet-of-Things fridge WhatsApp you
when you’re out of milk.3
2 No, turning the calculator upside down and using the numbers to write
rude words doesn’t count.
29
Exploring the Variety of Random
Documents with Different Content
The Project Gutenberg eBook of The Chapel on
the Hill
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Language: English
Credits: Transcribed from the 1904 Deighton Bell & Co. edition
by David Price
THE CHAPEL
ON THE HILL
BY
ALFRED PRETOR
FELLOW OF ST. CATHARINE’S COLLEGE, CAMBRIDGE
AUTHOR OF ‘RONALD AND I’
CAMBRIDGE
DEIGHTON BELL & CO.
LONDON GEORGE BELL & SONS
1904
CAMBRIDGE
PRINTED BY JONATHAN PALMER
ALEXANDRA STREET
To the
memory of
‘Judy’
(Ob. Aug. 27, 1904)
Riverdale and I—to wit one Harold Stirling by name—had been close
friends almost since life began, at our private school, our public
school, and again at college. And we were meeting now for the last
time as undergraduates in Riverdale’s rooms at Cambridge. For the
choice that comes, once at any rate in a lifetime, to all, had come to
us, and we had chosen divergent, to some it would appear
antagonistic, careers.
To judge from his personal appearance, Riverdale at any rate had
chosen wisely for himself when he elected to become an artist.
Smoking at his ease, in a picturesque environment of flowers and
ferns, pictures and statuettes, he looked like what he was—a well-to-
do indolent dreamer, who might possibly succeed as a painter, but
would never make much of life in any other line. Fortunately for him
he had no need to trouble himself about the future. A kindly fate
had settled all this in advance, when his only surviving relative, an
uncle, had made him a comfortable allowance of a thousand a year,
adding the still more comfortable assurance that the family estate of
Riverdale should be his when the time came that he himself should
have no further use for it.
Study him, as the glow from a reading-lamp falls full on his features,
and you will say that his personality is concentrated in his eyes.
Sapphire blue they would have been called by a casual observer, but
it always seemed to me that they held in them a deeper tint, as of
violet or purple. But whatever their colour, they are about as rare in
humanity as is a blue rose or a green chrysanthemum among the
creations of the floral world. Not that they betoken much character,
I think. It is simply their beauty, and perhaps their rarity, that
constitutes the attraction. At any rate, veiled by long lashes, and set
in Italian features, as was the case with Riverdale, it is impossible to
hold them indicative of energy or activity in life.
It was a strange coincidence that had made bosom friends of two
natures so antagonistic, to all appearance, as Riverdale’s and mine.
But it was a coincidence that occurs oftener than would at first sight
seem possible. Perhaps it is explicable by the well-known theory
that every character is on the search for its complement. If so, it
may well be that my own sturdy directness found its natural
relaxation in the captivating indifferentism of my friend. Anyhow,
the companionship had begun early at school, where a mutual
admiration for one’s opposite is often the secret of a lifelong
friendship. And as Riverdale’s good looks and careless insouciance
had always been found irresistible, it was my own commonplace
personality that was envied by my schoolfellows for the dignity it had
acquired by his friendship.
And now that I have given you an idea of my friend, let me for once
attempt the impossible and try to describe myself. An athlete I think
I may call myself, for I have raced and rowed and played cricket and
football ever since I was a boy of ten—of the type which is
welcomed in all our schools as the recognised trainer of youth. Not
so very plain, I hope, and certainly well set up in the way of muscles
and sinews. But quite as certainly not in any way striking like
Riverdale, and without the faintest pretension to anything
remarkable in the direction of beauty. Finally, and to complete the
portrait, fair in complexion, with blue eyes and a slight tendency to
freckles, which I abominate. In all respects a worthy foil to
Riverdale’s dreamy picturesqueness.
Left an orphan at an early date, with a comfortable income of £300
a year, I had never known the want of money, though I had no large
balance to waste on the luxuries that had become necessaries to my
friend. Without any real talent, and notwithstanding my devotion to
athletics, I had taken a fair degree, and learned something of
theology under the guidance of one of the leading minds at
Cambridge. Only as yet I had come to no conclusions outside the
main doctrines of our faith; and to what end my views were shaping
themselves I had never paused on my way to consider. Experience
and circumstances, as they developed themselves, would, I
supposed, answer the question, and, having been confronted as yet
by no definite difficulties, I had not troubled to bethink me how I
should meet them.
“And now tell me, Eric,” I asked, “where are all the Cupids and
Psyches and Fauns to go while you are painting dusky Venetians and
the fair-haired beauties of Genoa?”
“Oh, I’ve taken a flat, Harold, in a house overlooking Battersea Park,
and they’ll all be transferred there as soon as I am off to-morrow.
By the way, you must look in on them now and then, and see that
they are all right. And you must have that little gladiator I brought
from Rome for yourself. It would never do to separate you, for I’m
sure you’d never be happy without him. Rather like you, I think he
is, with his steady sturdy gaze, as if he knew he had a tough
business before him, but intended to make the best of it, and worry
through. Lucky we weren’t born in each other’s shoes, any way for
me, Harold. I couldn’t have faced life without funds, but should
have drifted down and down till I ended the business with a dose of
morphia.”
“What nonsense, Eric. I do wish you wouldn’t cheapen yourself like
that. You’ve talent enough for both of us, and will be exhibiting in
the Academy while I’m a country curate, and a poor one at that. By
the way, if you don’t mind, I’d sooner have that Antinous than the
gladiator. I don’t particularly want a replica of myself, if it’s all the
same to you, while you might have posed for the Antinous, if you’d
been handy; and it will be better than nothing to have it to look at
when I haven’t got the original on the other side of the table. And
now, old friend, good-bye. It’s past twelve already, and I’ve all my
packing to do before the morning. For I shall be off long before a
sybarite like you thinks of stirring. Let me hear from you now and
then, and don’t let the foreign signoras and Roman models steal all
your heart from me.”
The next day we had parted; he to enjoy life and study art in all the
best galleries on the continent, and I to prepare myself for
Ordination in a quiet village of the West.
CHAPTER I
Like his brother at the Manor House hard by, my Rector, Mr.
Richardson, was a widower, having lost his wife only six months
before my arrival. His family was comprised of four children, whose
ages descended by even gradations from Reginald, the eldest, a
handsome lad of eighteen whose school-life had just ended, down to
Aggie the youngest, a wild little maiden of twelve.
As yet their characters were still unformed, and had been entrusted
for their development to a clever little Belgian, Josephine Armand by
name, who, in addition to the superintendence of their education,
managed the Rector’s household for him, and ruled the domestics
with a rod of iron.
On the day after my arrival I was studying the church and the
streets of the village, which radiated like a fan from the foot of the
hill where I stood, when I was met by Reginald who had dined with
us the evening before. He was to start early the next day for the
continent, where he was to pick up what foreign languages he could
before he entered at Cambridge in the following October.
By the gate of the churchyard, through which we passed to the
Rectory, stood a time-worn placard requesting visitors not to touch
any of the flowers “excepting those on their own graves.”
“A remarkable instance of realistic prevision,” said Reggie, “and far
too good to be improved away. Fortunately our villagers are not
keenly appreciative of humour, else the best joke in the county
would have been lost to us long ago. And what are you up to, my
children?” he added, looking in at the window of the Rectory
schoolroom, where his sisters were busily writing at the untidiest of
tables, forgetful for once of the glorious sunshine that blazed down
upon the world outside. “Some mischief, I’ll be bound, else you’d
never be so abnormally quiet.”
“You go on, and don’t disturb us, Reggie,” said Agnes, a lean wiry
girl, with hair much dishevelled under the excitement of
composition. “We are busy preparing verses for the Attar
competition prize, the new dentifrice, you know; you may hear mine
if you like. I go in for plain and simple fact—‘beauty unadorned’ you
see:
But I wish I were handier at drawing. King Attar in his chair of state
is all out of perspective. And the flying dentists look like a lot of
daddy-longlegs; while as for their implements, they might be
anything you please. However, I can easily remedy that by drawing
lines to the margin with an explanation of each particular instrument
—‘these are tweezers,’ ‘this is a file’—like Melton Prior does in his
war pictures, you know.”
“Capital! You’ve got everything cut and dried, I see. Though, by the
way, you needn’t talk bad grammar under the stimulus of
composition. Didn’t your governess teach you that ‘like Melton Prior
does’ is bad grammar? If not, she isn’t worth her salt.”
“It’s our French, Reggie, that troubles her more than our English. At
any rate, when she called us in to dinner yesterday, I said, ‘Je suis
déjà,’ meaning, of course, ‘I am all ready,’ and she had just the
faintest suspicion in the world that I intended it for a joke, and
boxed my ears on the chance.”
“And served you jolly well right for your cheek. But I can’t stop
chattering here. Give me half the prize if you get it, for the
encouragement I’ve given you.”
As the door closed upon him something suspiciously like the sound
of a kiss was heard in the corridor outside, whereupon the door re-
opened and a laughing face peeped in at the children.
A dainty little personage she was, to whom her cousin Reggie had
long ago given his heart. And a pretty picture she made in the
school-room as the sunlight fell on her hair from the window
opposite, and warmed its ruddy glow to the famed Venetian tint.
Not the very highest type of beauty, perhaps. At any rate the best
masters of antiquity would not have sanctioned the tip-tilted nose
and over-large mouth. Yet even they could have found no fault with
the delicate poise of the head, the shapely neck, above all, with the
tawny hazel eyes and slyly drooping lids; and you must have gone
direct to the Faun of the Capitol if you had wished to rival the sunny
brightness of the face, and the rippling smile that played about her
lips. Almost one expected to catch a glimpse of the pointed ears
which Donatello was supposed to conceal behind his curls.
“Well, you pickles,” she exclaimed, “and where’s your guardian angel
Josephine gone? Not left you to your own devices if she’s a wise
woman.”
“Oh! she’s off to the garden, Cousin Marion, ‘to cut a cabbage to
make an apple pie,’ as Verdant Green said. I mean she’s gone to dig
up all the weeds and dandelions that lie handy. ‘It must be,’ she
said, ‘that I have herbs—savage herbs—to aid the digestion.’ Only
the other day she half poisoned herself with celandine roots, which
she thought looked promising for the composition of a salad.”
“She’s as good as another gardener,” put in Gertie, “and does all the
weeding. Besides, she’s so beautifully tidy, and consumes all that
she gets, like a well-regulated bonfire. But do stay a minute and
help us, Marion. We’re making poetry to win the Attar Competition.
Do give us a verse or two; we’ve used up all our ideas.”
“What I, my child? Why, I never made a line of poetry in my life,
and hardly ever remembered one. See how the very thought of it
has made me fly.” At the door she looked back laughing:
And, laughing still, she fled—fortunately without seeing me, who had
watched the proceedings unobtrusively from the shelter of a friendly
clematis.
CHAPTER III
The old Manor House was looking its best, as half an hour later I
walked up through the avenue by which it was approached.
Planted against the south-west side of a hill, the ground gently
falling away in front of it, it caught the evening sun, which burnished
the trees on either side, and called up all the lovely shades of colour
that lie dormant in old red brick, as the fires that are latent in opal
and carbuncle wake up at the touch of light. It is the fashion
already to disparage Ruskin, and to find that we have over-rated him
like so many of our heroes, but at any rate he was right in his
devotion to the fine red brick of Elizabethan architecture. One
marvels how any one who has looked upon Hatfield or Aston can
condescend to build in any other medium. There is much stone, I
know—Ham Hill by preference—that takes a lovely colouring from
age, to which lichen and stonecrop and ivy would seem to have an
instinctive affinity. But the setting provided by Nature, and the
requirements of our dull uncongenial atmosphere find their proper
complement, I think, in a brick-dust red, just as surely as they
repudiate its vile twin brother, the white and yellow clay which time
in its progress only makes more and more disreputable.
That evening, for the first time, I recognised that I was in love with
Marion—a love that must have had in it no steps and no gradations.
The leap must have been taken at a bound on the day that I caught
my first glimpse of her in the Rectory nursery, though I suppose time
added fresh strength to my devotion by developing fresh features of
sympathy and mutual interest.
Our party, as I have said, was limited to four, and as the Rector and
his brother at once paired off for the evening, Marion was left to my
care, and our acquaintance progressed rapidly.
Squire Richardson was, in character and even in appearance, a
replica of his brother—a replica with a single difference. The Squire
loved foxhunting with all the devotion of a country gentleman, while
to the Rector it was the one sport above all others of which he was
intolerant. They had hardly sat down to dinner when the question
turned up, and it was nearly over before they had threshed it out
without the smallest advantage to either side. The Rector was the
assailant.
“How, Edgar, you can possibly justify the cruelty of hunting an
animal which you can’t eat, or use for any purpose when you’ve
killed it, I can’t conceive. Talk of a bull-fight—nonsense, why it’s a
fair fight by comparison. The bull is Master of Ceremonies up to the
time of its death, and then it’s killed painlessly by a single blow. And
its flesh serves the best purpose imaginable, for it’s distributed
round among the poor of the city, who, but for the chance, would
never taste any meat but pork from one year’s end to another. Only
the other day I had a specimen of the methods of your sport. A
miserable fox that had been kept in agonies of terror for half-an-
hour was hunted out of its shelter behind a rock, and deliberately
torn to pieces in a shallow lake to which it had taken itself as a last
refuge. Justify that, Edgar, if you can.”
“Nonsense, Walter,” was the Squire’s reply. “The case was one in a
thousand. The sport, man, is the making of the British yeoman—
breeds pluck and manliness and good riders and good fellowship,
and a hundred other virtues. Besides, what of the horses in a bull-
fight? Have they any of the sport which you tell me the bull
enjoys?”
“Well—no. I grant you have me there. Only unluckily it can’t be
avoided, they told me in Spain. There’s no man living, whatever his
skill and courage, who could tackle one of those wild Spanish bulls if
it came fresh and untired to his hand. And the horses are poor
wretched screws whose life is valueless and worse to them.
Besides, the bull kills them at least as painlessly as they would die
by neglect or in some knacker’s yard. Only it’s a sport that does not
bear transplanting to the provinces. You must see it at Seville or
Madrid—or nowhere.” And while the argument between them raged
furiously, but in a perfect spirit of friendliness, Marion and I were left
to ourselves—an opportunity of which I was not slow to avail myself.
“Butchered to make a British holiday!” shouted the Rector.
“Rather to give mettle to our horses and manliness to our men!”
shouted back the Squire.
With a smile of despair, and a nod in my direction that answered my
unspoken query for permission to accompany her, Marion slipt
quietly through the open window out on to the terrace, and I
followed her.
“They’ll go on like that,” she said, “till they’ve finished their wine.
And the best of it is they never lose their temper, but end as
amicably as they began. It’s a really pretty object-lesson in Christian
forbearance.”
It was a glorious summer evening, soft and still, with a glow in the
sky that might have been a reflection of the noontide glare, as we
went down the steps of the terrace and across the velvet sward of
the old pleasaunce out into the shrubberies beyond.
“I wonder which side of the question you took at dinner?” I asked,
anxious to find whether the advanced theories of the Rector had
found an echo in herself.
“Oh, on the question of hunting,” she answered, “I’m with him. It
savours, I think, of torturing. Of course it’s difficult,” she added, “to
see where to draw the line. For I don’t think we were intended to
be vegetarians. We haven’t the proper teeth, have we? And so it
seems to me that his distinction is a tenable one, and that we may
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