​
Slide
1
of
16

Wolfram Language for Python Users

Creating a Unified Workflow
​
​
Slide
2
of
16

Outline


  • History & Comparison
  • 
  • What is Wolfram Language?
  • 
  • Principles of Wolfram Language
  • 
  • Code Structure
  • 
  • Some Example Workflows
  • 
  • Calculus
  • 
  • Functional Programming
  • 
  • Data Analysis
  • 
  • ExternalEvaluate Framework
  • 
  • Resources
  • ​
    ​
    Slide
    3
    of
    16

    Introduction

    Key Questions

    
  • How does Wolfram Language stack up to Python?
  • 
  • What is transferable between Python and Wolfram Language?
  • 
  • What are the best practices for a combined experience?
  • ​
    ​
    Slide
    4
    of
    16

    History & Comparison

    Python

    
  • First published in 1991 (see history)
  • 
  • Current: V3.14 (February 2026)
  • 
  • Object-oriented language that emphasises readability
  • 
  • The first Python notebooks appeared in IPython (2001)
  • Wolfram Language

    
  • First released in 1988 (see release history)
  • 
  • Current: V14 .3 (August 2025)
  • 
  • A combined kernel (Wolfram Language) and front-end notebook (Mathematica) interface
  • 
  • Symbolic computation
  • 
  • Allows for arbitrary structures and data
  • ​
    ​
    Slide
    5
    of
    16

    What Is Wolfram Language?

    Maths
    Data
    Graphs
    Images
    Documents
    Graphics
    3D Graphics
    Sound
    Neural Net
    Chemicals
    Programs
    Interface
    ​
    Slide
    6
    of
    16

    Principles of Wolfram Language?

    ​
    Slide
    7
    of
    16

    Broad Comparison

    Differences

    Python

    
  • An open-source language developed by members of the community
  • 
  • Free to use but a number of implementations and dialects
  • 
  • Some functionality is not forwards/backwards compatible with major releases
  • 
  • Ships with minimal primitives, and relies on externally developed packages
  • Wolfram Language

    
  • A single-source language, developed in-house at Wolfram Research Inc.
  • 
  • Proprietary licence but consistent, centralised maintenance of language and documentation
  • 
  • Virtually all internal functions are backwards compatible
  • 
  • A great deal of functionality is provided out of the box
  • ​
    Slide
    8
    of
    16

    Code Structure

    Example: Determine Whether A Number Is Prime

    Writing Wolfram Language code in the style of Python is often possible…
    …but alternative approaches are also possible:
    ​
    Slide
    9
    of
    16

    Out-of-the-Box Functionality

    Functions for… Everything

    See the cumulative numbers of Wolfram Language symbols introduced in successive major versions:
    With so many built-in functions, there’s a good chance the hard work has been done for you:
    Built-in functions are always quicker than user-made functions:
    ​
    Slide
    10
    of
    16

    Examples

    Calculus

    Example: Integration

    Python
    〉
    In[]:=
    print('Hello world')
    Wolfram Language
    ​
    Slide
    11
    of
    16

    Core Language

    Example: Letter Counts

    Find the number of letters across several words and find their product.
    Python
    In Python, anonymous functions are made with lambda functions and primitives are limited to a few data types:
    Wolfram Language
    In Wolfram Language, anonymous functions use Function:
    ​
    Slide
    12
    of
    16

    Functional Programming

    Guide: Functional Programming

    Example: User-Defined Functions

    Python
    In Python, branching functions are common:
    Wolfram Language
    In Wolfram Language, overloading with extensive pattern matching is more common:
    ​
    Slide
    13
    of
    16

    Data Analysis

    Example: Classifier

    Produce a simple classifier based on a multivariate dataset that returns survival probabilities.
    Get some data on the Titanic:
    Python
    In Python, machine learning requires prior knowledge (e.g. logistic regression):
    Use an inline TemplateExpression:
    Wolfram Language
    In Wolfram Language, machine learning workflows are clean and largely automated.
    Train a classifier on the data:
    The classifier can now be used to make novel predictions:
    Deploy an API that uses the classifier:
    ​
    Slide
    14
    of
    16

    Extra

    Passing Data Between Python & Wolfram Language

    Inject Wolfram Language as a string:

    Chess

    Let’s consider an example that uses the external Python package chess:
    Start another external session:
    Now the state of a chessboard can be represented by an ExternalObject:
    We can define an ExternalFunction to plot the board:
    We can just pass our external object to the external function:
    We can also directly extract attributes of the external object:
    Making a move changes the state of the external object:
    Let’s compute all legal moves from the current position, and obtain the UCI string representations of these:
    Or, accomplish the same within an external session using ExternalOperation:
    Check out this Wolfram Language paclet for chess!
    ​
    Slide
    15
    of
    16

    Wolfram Client Library For Python

    Utilising Wolfram Language within Python requires the Wolfram Client Library for Python.
    This requires at least Python v3.5 and Wolfram Language v11.3.
    It can be installed using pip or by cloning the Git repository.
    The client library allows Python to:
    
  • Evaluate any Wolfram Language expression
  • 
  • Access any of Wolfram Language’s built-in functions
  • 
  • Access the Wolfram Knowledgebase
  • 
  • Utilise Wolfram|Alpha's natural language processing
  • 
  • Construct expressions to be evaluated once they enter a Wolfram environment
  • Wolfram Language code generated from within an external code cell will evaluate once the result enters the Wolfram environment:
    〉
    In[]:=
    from wolframclient.language import wl, wlexpr
    ​
    x = wl.Select([1, 2, 3, 4, 5, 6, 7, 8], wl.PrimeQ)
    print(x)
    x
    Call the API we deployed earlier with Python:
    〉
    In[]:=
    from wolframclient.evaluation import WolframCloudSession
    cloud = WolframCloudSession()
    ​
    api = ('josephb', 'api/public/titanic') # Change to your own $Username
    result = cloud.call(api, {'classification': '1st', 'age': 20, 'gender': 'male'})
    ​
    result.get().decode("utf-8")
    Create an embeddable version in a language of your choice—for example, Python:
    〉
    <paste code here>
    〉
    In[]:=
    from wolframclient.language import wl
    wl.ImportByteArray(call('1st', 20, 'male'))
    ​
    Slide
    16
    of
    16

    Resources

    
  • Configure Python for ExternalEvaluate
  • 
  • Execute a Python File with ExternalEvaluate
  • Other

    
  • See the Wolfram Blog: Why Wolfram Tech Isn’t Open Source – A Dozen Reasons
  • 
  • See the Wolfram Blog: Six Reasons Why the Wolfram Language Is (Like) Open Source
  • 
  • See our Public Resources here
  • 
  • Latest Features in Wolfram Language here