SlideShare a Scribd company logo
replacing
import with
accio in
CPython
>>> import sys!
>>> accio sys!
SyntaxError
>>> import sys!
>>> accio sys!
SyntaxError
>>> import sys!
>>> accio sys!
SyntaxError
>>> accio sys!
>>> import sys!
SyntaxError
>>> accio sys!
>>> import sys!
SyntaxError
>>> accio sys!
>>> import sys!
SyntaxError
why?
we’ll learn:!
what is a
statement
we’ll learn:!
what is a
SyntaxError
we’ll learn:!
how does
Python know
the difference?
we’ll learn:!
bootstrapping
!
replacing
import with
accio
import is a
statement
statements
are defined in
the Grammar!
file
import_stmt: !
import_name | !
import_from
import_name: !
‘import’ !
dotted_as_names
first attempt
import_name: !
‘accio’ !
dotted_as_names
$ make
import sys!
^!
SyntaxError:
invalid syntax
oops
second
attempt
$ sed ’s/
import/accio’
$ make
accio sys!
^!
SyntaxError:
invalid syntax
bootstrapping
!
third attempt
import_name: !
‘import’ !
dotted_as_names!
| ‘accio’ !
dotted_as_names
$ make
$PATH
import_name: !
‘accio’ !
dotted_as_names
$ sed ’s/
import/accio’
$ make
>>> accio sys!
>>> import sys!
SyntaxError
>>> accio sys!
>>> import sys!
SyntaxError
>>> accio sys!
>>> import sys!
SyntaxError!
links
• Grammar - https://docs.python.org/2/reference/
grammar.html
• EBNF - http://en.wikipedia.org/wiki/
Extended_Backus%E2%80%93Naur_Form
• Adding a statement - http://
eli.thegreenplace.net/2010/06/30/python-
internals-adding-a-new-statement-to-python/
@amygdalama!
mathamy.com

More Related Content

Viewers also liked

Report1
Report1Report1
Report1
MaRwa Hamed
 
Cloudezz - Platform-as-Infrastructure via Turnkey Private Cloud
Cloudezz - Platform-as-Infrastructure via Turnkey Private CloudCloudezz - Platform-as-Infrastructure via Turnkey Private Cloud
Cloudezz - Platform-as-Infrastructure via Turnkey Private Cloud
cloudezz
 
Skoleprojekt - e-konceptudvikling - Redesign af 4yourbody
Skoleprojekt - e-konceptudvikling - Redesign af 4yourbodySkoleprojekt - e-konceptudvikling - Redesign af 4yourbody
Skoleprojekt - e-konceptudvikling - Redesign af 4yourbody
Mia Christensen
 
C9 booklet
C9 bookletC9 booklet
C9 booklet
iuliana militaru
 
Skoleprojekt - e-konceptudvikling- Kvindemuseet
Skoleprojekt - e-konceptudvikling- KvindemuseetSkoleprojekt - e-konceptudvikling- Kvindemuseet
Skoleprojekt - e-konceptudvikling- Kvindemuseet
Mia Christensen
 
Practice guidelines for postanesthetic care 2013
Practice guidelines for postanesthetic care 2013Practice guidelines for postanesthetic care 2013
Practice guidelines for postanesthetic care 2013
Ann Sodders
 
Altarix review
Altarix reviewAltarix review
Altarix review
Altarix
 
Codechamps offering 26_mar14
Codechamps offering 26_mar14Codechamps offering 26_mar14
Codechamps offering 26_mar14
Robert Eckart
 
Ajeet_GE(1)
Ajeet_GE(1)Ajeet_GE(1)
Ajeet_GE(1)
ajeet singh
 
Экспертные системы: лекция №4
Экспертные системы: лекция №4Экспертные системы: лекция №4
Экспертные системы: лекция №4
Laboratory of Information Science and Semantic Technologies
 
Vietnam Where to go
Vietnam Where to goVietnam Where to go
Vietnam Where to go
Linh Le
 
σύντομο βιογραφικό μαρίας πολυδούρη
σύντομο βιογραφικό μαρίας πολυδούρησύντομο βιογραφικό μαρίας πολυδούρη
σύντομο βιογραφικό μαρίας πολυδούρη
sotirisgar
 
Cec slides
Cec slidesCec slides
Cec slides
Scott Brittenham
 
The Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer Masterclass
The Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer MasterclassThe Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer Masterclass
The Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer Masterclass
Sagittarius
 

Viewers also liked (15)

Report1
Report1Report1
Report1
 
Cloudezz - Platform-as-Infrastructure via Turnkey Private Cloud
Cloudezz - Platform-as-Infrastructure via Turnkey Private CloudCloudezz - Platform-as-Infrastructure via Turnkey Private Cloud
Cloudezz - Platform-as-Infrastructure via Turnkey Private Cloud
 
Skoleprojekt - e-konceptudvikling - Redesign af 4yourbody
Skoleprojekt - e-konceptudvikling - Redesign af 4yourbodySkoleprojekt - e-konceptudvikling - Redesign af 4yourbody
Skoleprojekt - e-konceptudvikling - Redesign af 4yourbody
 
C9 booklet
C9 bookletC9 booklet
C9 booklet
 
Skoleprojekt - e-konceptudvikling- Kvindemuseet
Skoleprojekt - e-konceptudvikling- KvindemuseetSkoleprojekt - e-konceptudvikling- Kvindemuseet
Skoleprojekt - e-konceptudvikling- Kvindemuseet
 
Practice guidelines for postanesthetic care 2013
Practice guidelines for postanesthetic care 2013Practice guidelines for postanesthetic care 2013
Practice guidelines for postanesthetic care 2013
 
Print
PrintPrint
Print
 
Altarix review
Altarix reviewAltarix review
Altarix review
 
Codechamps offering 26_mar14
Codechamps offering 26_mar14Codechamps offering 26_mar14
Codechamps offering 26_mar14
 
Ajeet_GE(1)
Ajeet_GE(1)Ajeet_GE(1)
Ajeet_GE(1)
 
Экспертные системы: лекция №4
Экспертные системы: лекция №4Экспертные системы: лекция №4
Экспертные системы: лекция №4
 
Vietnam Where to go
Vietnam Where to goVietnam Where to go
Vietnam Where to go
 
σύντομο βιογραφικό μαρίας πολυδούρη
σύντομο βιογραφικό μαρίας πολυδούρησύντομο βιογραφικό μαρίας πολυδούρη
σύντομο βιογραφικό μαρίας πολυδούρη
 
Cec slides
Cec slidesCec slides
Cec slides
 
The Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer Masterclass
The Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer MasterclassThe Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer Masterclass
The Search Challenge - Sagittarius 24/7 Multichannel Travel Cosumer Masterclass
 

Recently uploaded

Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
Matthias Neugebauer
 
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdfAcumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
BrainSell Technologies
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
Baishakhi Ray
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
Safe Software
 
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptxMAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
janagijoythi
 
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
Priyanka Aash
 
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
Priyanka Aash
 
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
Torry Harris
 
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
maigasapphire
 
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
Priyanka Aash
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
SynapseIndia
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
DianaGray10
 
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptxIntroduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
313mohammedarshad
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
bhumivarma35300
 
Integrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecaseIntegrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecase
shyamraj55
 
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
sunilverma7884
 
(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf
(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf
(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf
Priyanka Aash
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
Ivanti
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
ldtexsolbl
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
DianaGray10
 

Recently uploaded (20)

Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
 
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdfAcumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
 
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptxMAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
 
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
 
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
 
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...Evolution of iPaaS - simplify IT workloads to provide a unified view of  data...
Evolution of iPaaS - simplify IT workloads to provide a unified view of data...
 
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
 
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
 
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptxIntroduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
 
Integrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecaseIntegrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecase
 
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
 
(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf
(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf
(CISOPlatform Summit & SACON 2024) Regulation & Response In Banks.pdf
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
 

Replacing `import` with `accio` in cpython