Arrays for architects: the one Python list that holds your building
Learn the one data structure behind every generative script: from w3schools' fruit list to looping your whole IFC model with IfcOpenShell. Day 1 of Python for AEC.
The generative structural-grid solvers that PAZ’s own concept panels describe — the ScienceDirect reviews of a “ladder of autonomy” from L0 upward, the tiny evolutionary loop that reorganises a column grid until every clear span stays under 8 m — all rest on one unglamorous object. Not a neural net. A list. In that solver a population of 40 candidate grids runs 60 generations as an array of bay-count tuples; sort it, keep the elite, breed the rest. Learn the array and you have learned the load-bearing wall of every generative script you will ever run.
w3schools puts it in one line — myFruits = ['banana','apple','orange'] — and the first value sits at index 0, not 1. That off-by-one is where every self-taught architect loses their first afternoon. The page then walks the same six operations — read, update, insert, remove, length, loop — across four languages: Python, JavaScript, Java and C++. Different syntax, identical idea. For a working office, the idea is the asset; the syntax is disposable.
←TODAY: In 2026 model.by_type("IfcWall") hands you an array — index 0 is your first wall, addressable by number. →3012: Zurich-3012 reads its towers the way you read a list: every element indexed, none locked behind a vendor. Fulcrum: A model you can loop over is a model you can still repair when the software that drew it is gone.
The Tool: This tutorial runs on IfcOpenShell, the open-source library started by Thomas Krijnen for reading and writing IFC — the plain-text ISO 16739 (IFC4) schema PAZ treats as the most important language the AEC industry has built in a century. It is worth an architect’s afternoon because it turns a whole building into exactly the arrays w3schools describes: ask it for walls and you get a Python list you can index, measure with len(), and loop through — no Archicad or Rhino session open.
Setup:
pip install ifcopenshell
python
>>> import ifcopenshell
>>> model = ifcopenshell.open("house.ifc")
>>> walls = model.by_type("IfcWall")
>>> print(len(walls), "walls; first is", walls[0].Name)First steps:
1. Grab any IFC — an export from Archicad or Bonsai, or a sample file — and drop it beside your script as house.ifc.
2. Run the block above. by_type returns an array; len(walls) gives its length, walls[0] its first member. This is the w3schools length and read operations, straight on your building.
3. Filter into a new list — tall = [w for w in walls if w.Name and "EXT" in w.Name]. You just did insert the Pythonic way, building a fresh array instead of mutating the old one.
4. Loop and print. Six lines, and you have queried a model without opening the model.
Atelier: For a Swiss studio, this is the moment the BIM model stops being a black box you scroll and becomes data you can interrogate. An office living with AI copilots still needs to verify what the machine proposes — and a three-line loop over by_type checks a hundred walls faster than any plugin dialog. This Monday, pick one IFC export and write a script that prints the count of every element type; that single number per class is your first automated model-audit.
Hack: Walk the wall array and stop at the first one missing its property set — the office version of w3schools’ six-name listOfNames loop that prints “Found Bob!” and then breaks the moment it hits the target.
from ifcopenshell.util.element import get_psets
walls = model.by_type("IfcWall")
for i in range(len(walls)):
if "Pset_WallCommon" not in get_psets(walls[i]):
print("Wall", i, "-", walls[i].Name, "missing common props"); breakThe same index-and-break pattern that finds one name in a list of six finds one broken wall in a tender model — and saves the clash meeting where nobody knows which element failed QA.
One honest limit: the flexible list you love in Python — grow it, shrink it, mix strings and numbers — is a luxury. As w3schools spells out, C and Java arrays are stricter: fixed length, one datatype, stored contiguously in memory, which is why the page reaches for a Java ArrayList or a C++ vector the moment it needs to insert or remove. That rigidity is exactly why they are fast, and why BGR could report this year that dying COBOL still runs global banking and government infrastructure. Old, strict, boring code outlives the clever kind. The buildings that aged worst in my generation were not the ugly ones — they were the ones whose proprietary format went dark, unreadable by 2041. IFC is plain text on purpose: a 25-year-old should still open the file. Pick your stack this quarter with that test in front of you.
PAZ has covered the deeper end of this thread — our piece on David Rutten’s Galapagos shows the same array-driven population loop doing real structural optimisation, the branch of practical AI his Grasshopper (2007 onward) handed the whole industry. Arrays are where that begins.
Learn-it:
- Source page: w3schools — Arrays in Programming
- Exact-thinking backfill: Wolfram Blog — computational math & geometry
- PAZ context: Galapagos & the array-based solver
- Built with it: House of Hungarian Music — geometry PAZ optimised
Arrays are Day 1 of the PAZ Programming Bootcamp’s 7-day Python-for-architects sprint — the same on-ramp we run alongside our Grasshopper 2 training (we have taught it since the Alpha) and Rhino licensing as a Rhino reseller. Open a Python prompt tonight, type one list, and print index 0.
SOURCE · ↗
PAZ Kaffi · multidisciplinary editorial, led by PAZ Academy