Namespace
A global namespace is a top-level naming context that binds identifiers defined at the outermost level and distinguishes them from names in nested scopes.
The Well-Grounded Python Developer: How the pros use Python and Flask
A named container that organizes identifiers and their bindings to prevent naming conflicts and control name resolution.
- How it is used
- Organizes named application functionality so convenient names can coexist without collisions.
- How deep it goes
- Works through built-in, module, and function namespaces, including shadowing, name lookup, scope, and variable lifetime.
- Examples
- Uses expense-report directories, mailing addresses, competing add functions, and personalized email names.
- What you can do after
- Apply it via Python modules and Flask Blueprints to separate features and avoid naming conflicts.
Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains namespace →
Kubernetes in Action, Second Edition
A namespace is a Kubernetes API resource that groups namespaced objects and provides scopes for object names and permissions within a cluster.
- How it is used
- Organizes teams' or clients' API objects into separate naming scopes within one cluster.
- How deep it goes
- Works through listing, creation, targeting, isolation limits, and deletion diagnosis without treating namespaces as runtime isolation.
- Examples
- Uses same-named pods in separate namespaces, kubectl listings, and a Namespace YAML manifest.
- What you can do after
- Operate/configure namespaces with kubectl and manifests, and diagnose a namespace stuck terminating.
Read how Kubernetes in Action, Second Edition explains namespace →
Google Anthos in Action
A namespace is a Kubernetes logical partition that scopes and organizes namespaced resources within a cluster.
- How it is used
- Scopes resource names, organizes tenants in a shared cluster, and identifies deployment targets.
- How deep it goes
- Defines namespace scope and works through creation, labeling, and deployment preparation; defers details of individual security controls.
- Examples
- Uses a service-mesh application namespace, an on-prem Marketplace target namespace, and a GKE Elasticsearch deployment choice.
- What you can do after
- Operate/configure it with kubectl to create and label a namespace, then target it for application deployment.
The Quick Python Book, Fourth Edition
A global namespace is the namespace associated with a module, script, or interactive session and visible as the defining environment for its functions.
- How it is used
- Explains how Python namespaces organize bindings, prevent module name clashes, and determine which names functions and methods can access.
- How deep it goes
- Defines namespace mappings and walks through lookup and inspection, while directing readers to Python documentation for further detail.
- Examples
- Uses globals(), locals(), imported math functions, and a module function to display bindings and demonstrate a NameError.
- What you can do after
- Diagnose name lookup and inspect bindings using globals(), locals(), and dir().
Read how The Quick Python Book, Fourth Edition explains namespace →
100 C++ Mistakes and How to Avoid Them
The global namespace is the C++ namespace containing declarations that are not enclosed in another namespace.
- How it is used
- Highlights namespace collisions and shadowing that make C++ code harder to read and maintain.
- How deep it goes
- Explains collision and shadowing consequences through code, then contrasts unscoped names with qualified alternatives.
- Examples
- Uses traffic and paint colors alongside a circle with repeatedly named radius variables.
- What you can do after
- Diagnose name collisions and shadowing, and distinguish names using scoped enums or namespace qualification.
Read how 100 C++ Mistakes and How to Avoid Them explains namespace →
Clojure: The Essential Reference
A namespace is a Clojure scope that organizes and qualifies names such as functions and variables.
- How it is used
- Organizes access to standard-library names and provides the context for mappings, aliases, and vars.
- How deep it goes
- Defines mapping and alias tables and identifies the global repository, without elaborating garbage-collector mechanics.
- Examples
- Uses clojure.string/upper-case and an ns-map lookup that retrieves and calls the var mapped to +.
- What you can do after
- Diagnose/debug with it: inspect mappings using ns-map, inspect aliases using ns-aliases, and distinguish namespaces from loaded libraries.
Read how Clojure: The Essential Reference explains namespace →
Authorization in Action
A namespace is a prefix or naming context that distinguishes entities, actions, policies, or types belonging to different domains or systems.
- How it is used
- Distinguishes identities, entity types, and actions so authorization policies refer to the intended domain.
- How deep it goes
- Defines namespace uniqueness and compares centralized and hierarchical structures, then explains Cedar qualification and type-safety benefits.
- Examples
- Uses reused employee numbers and furniture versus database Table types to illustrate identity and naming conflicts.
- What you can do after
- Evaluate namespace boundaries and identifier reuse for potential authorization and audit risks.
Python How-To
A global namespace is the module-level namespace that maps identifiers to their corresponding objects.
- How it is used
- Uses namespaces to explain how Python finds names and why assignments across scopes can produce unexpected results.
- How deep it goes
- Defines namespaces as mappings and works through inspection and LEGB lookup, including an unsuccessful cross-scope assignment.
- Examples
- Uses a Task class and instance, a database filename assignment, and a debugger snapshot of function variables.
- What you can do after
- Diagnose/debug with globals() and locals() to inspect module and function names.
F# in Action: A Revised Edition of Get Programming with F#
A namespace is a programming-language construct that groups and qualifies names to organize code and avoid naming collisions.
- How it is used
- Groups related .NET types and provides qualified paths for accessing them.
- How deep it goes
- Explains declaration scope, nested paths, qualification, and opening namespaces, then offers guidance on when modules suffice instead.
- Examples
- Uses `System.DateTime`, nested file-related namespaces, and `Foo.Order` before and after `open Foo`.
- What you can do after
- Operate/configure it with F# `namespace` and `open` declarations to group types and shorten references.
Read how F# in Action: A Revised Edition of Get Programming with F# explains namespace →
Kubernetes for Developers
A Kubernetes namespace is a logical scope that groups and isolates named resources within a cluster.
- How it is used
- Separates environments and applications while supporting repeatable, configuration-driven Kubernetes deployments.
- How deep it goes
- Explains naming, context selection, reuse, and rollout safeguards, but does not detail namespace internals.
- Examples
- Uses production and staging namespaces, repeated resource names, kubectl commands, reusable YAML, and namespace-checking rollout scripts.
- What you can do after
- Operate/configure environments by selecting namespaces, reusing manifests, and validating rollout targets before applying changes.
Refactoring to Rust
A namespace is a named scope that contains identifiers and distinguishes them from identifiers in other scopes.
- How it is used
- Organizes Rust library code into modules and controls how functions, types, and other items are named and accessed.
- How deep it goes
- Explains module namespaces, visibility, imports, and relative or absolute paths through progressively refactored examples.
- Examples
- Demonstrates greeting modules and a libsnack crate using imports, pub items, crate paths, and super paths.
- What you can do after
- Diagnose name-resolution errors and organize functions or types with Rust modules, visibility, imports, and paths.
Python Workout, Second Edition
A namespace is a mapping that associates names with objects and separates those names from other naming contexts.
- How it is used
- Uses modules to organize reusable definitions and prevent naming collisions across files.
- How deep it goes
- Explains module namespaces, import-bound names, and filesystem lookup through sys.path, but stops short of deeper import internals.
- Examples
- Demonstrates import os, qualified module access, from os import sep, and module lookup through sys.path.
- What you can do after
- Apply it via Python's import statement to reuse definitions and choose qualified or direct name bindings.
Read how Python Workout, Second Edition explains namespace →
MongoDB 8.0 in Action, Third Edition
A namespace is MongoDB's unique identifier for a collection formed by combining its database name and collection name with a dot.
- How it is used
- Identifies collections uniquely while inspecting MongoDB databases and collection metadata.
- How deep it goes
- Defines the database-qualified naming format, demonstrates its output, and states the 255-byte limit.
- Examples
- Uses sample_mflix.embedded_movies and db.getCollection("embedded_movies") as concrete namespace examples.
- What you can do after
- Operate mongosh to list collections, inspect metadata, and display a collection's fully qualified namespace.
Read how MongoDB 8.0 in Action, Third Edition explains namespace →
Modern C
An identifier namespace is a C naming domain in which identifiers are associated with distinct kinds of entities and may have separate collision rules.
- How it is used
- Guides C naming policy and limits the names exposed through interfaces.
- How deep it goes
- Defines several C identifier categories and collision risks, but stops short of detailing each namespace's formal lookup rules.
- Examples
- Uses a memory_sum declaration, possible collisions involving N, I, and strip, and a prefixed rewrite.
- What you can do after
- Apply a consistent naming policy and reduce conflicts by exposing fewer identifiers and using distinctive prefixes.
Platform Engineering on Kubernetes
A Kubernetes namespace is a logical scope that isolates and organizes namespaced resources within a cluster.
- How it is used
- Supports environment pipelines and multi-tenant platform layouts by logically partitioning resources within a Kubernetes cluster.
- How deep it goes
- Explains logical boundaries, RBAC, quotas, shared APIs, and isolation trade-offs, but stops short of implementation commands.
- Examples
- Uses namespace-per-environment layouts, shared development clusters, and separate staging and production clusters as contrasting deployment arrangements.
- What you can do after
- Evaluate namespace-based environment layouts and identify when separate clusters provide stronger isolation and access control.
Read how Platform Engineering on Kubernetes explains namespace →
.NET in Action, Second Edition
A namespace is a programming-language construct that groups related types and identifiers under a qualified name.
- How it is used
- Organizes .NET types while building a console application and separating reusable code from top-level program statements.
- How deep it goes
- Explains dotted hierarchies and using directives through C# listings, including how a type’s FullName displays its namespace.
- Examples
- Uses Figgle and HelloDotnet.AsciiArt, then illustrates hierarchy with System.Text.RegularExpressions.Regex.
- What you can do after
- Apply C# namespace declarations and using directives to place a class and refer to types in another namespace.
Read how .NET in Action, Second Edition explains namespace →
Type-Driven Development with Idris
A namespace is a named scope that organizes definitions and distinguishes their fully qualified names.
- How it is used
- Organizes definitions and permits names to be reused while Idris resolves them from context.
- How deep it goes
- Defines module-based and hierarchical scopes, then demonstrates qualified names and contextual resolution through REPL type inspection.
- Examples
- Uses List and String length functions, separate bind operators, and record fields reused across records.
- What you can do after
- Evaluate how Idris distinguishes same-named definitions by context and qualified name.
Read how Type-Driven Development with Idris explains namespace →
Systems Programming with Zig
A namespace is a named scope that groups program declarations and prevents naming conflicts.
- How it is used
- Uses namespaces to organize declarations and access them within and across Zig source files.
- How deep it goes
- Explains declaration access and imports, and notes that the compiler parses source files and structs using the same code.
- Examples
- Groups animal-noise functions in a struct and imports a public Fibonacci function from another file.
- What you can do after
- Apply it in Zig to group declarations, access them with dot syntax, and import public declarations from another file.
Effective Platform Engineering
A namespace is a logical partition that groups and isolates named resources within a cluster.
- How it is used
- Groups platform system resources and test applications into explicit cluster partitions.
- How deep it goes
- Defines namespaces through YAML and connects them to platform configuration, but does not detail namespace-level policy design.
- Examples
- Uses karpenter and test-system as concrete namespace names in cluster bootstrap manifests.
- What you can do after
- Operate/configure namespaces with kubectl and declarative Kubernetes YAML during cluster bootstrap.
Read how Effective Platform Engineering explains namespace →
Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
A namespace is a naming scope that groups related types and helps keep their identifiers distinct from types in other scopes.
- How it is used
- Organizes .NET types and gives custom PowerShell output objects distinctive, collision-resistant names.
- How deep it goes
- Defines namespaces, distinguishes them from classes, and demonstrates hierarchical naming without descending into namespace internals.
- Examples
- Uses System.Speech.Synthesis, Toolmaking.DiskInfo, and MyCompany.ITOps.Storage.DiskInfo as naming examples.
- What you can do after
- Apply it via hierarchical names that identify custom types without intruding on vendor-controlled namespaces.
Learn Go with Pocket-Sized Projects
A JavaScript namespace is a named scope or object used to organize and expose JavaScript-accessible functions and values.
- How it is used
- Organizes Go functions exposed to JavaScript by choosing between the global namespace and a specific JavaScript object.
- How deep it goes
- Shows function registration, object creation, property assignment, and browser invocation.
- Examples
- Uses a multiplication exercise with generate() globally or multiplyApp.generate() under a named object.
- What you can do after
- Apply it via Go's js API to expose a function globally or under a named JavaScript object.
Read how Learn Go with Pocket-Sized Projects explains namespace →
The Well-Grounded Rubyist, Fourth Edition
A Ruby namespace is a naming context that groups definitions and keeps names from different contexts distinct.
- How it is used
- Groups related definitions under nested names so similarly named classes, modules, or methods remain distinct.
- How deep it goes
- Explains nested definitions and `::` lookup, contrasts flattened names, and notes that notation alone cannot identify a class, module, or constant.
- Examples
- Uses `Tools::Hammer` and `Piano::Hammer`, plus Rake tasks named `admin:clean_tmp` and `admin:clean:tmp`.
- What you can do after
- Build nested class or module definitions and refer to a nested class using `::`.
Read how The Well-Grounded Rubyist, Fourth Edition explains namespace →
Also covered in
- Architecting an Apache Iceberg Lakehouse
- Python Workout: 50 ten-minute exercises
- Secrets of the JavaScript Ninja, Second Edition
- Practices of the Python Pro
- Data-Oriented Programming in JavaIn early access (MEAP)
- The Joy of JavaScript
- Amazon Web Services in Action, Third Edition: An in-depth guide to AWS
- React in Depth
- Web Components in Action
- Learn C++ by Example
- Functional Programming in Scala, Second Edition
- Pro ASP.NET Core 7, Tenth Edition
What to know first
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- attributeAn attribute is a named property or piece of information associated with an entity, object, or structured data item.
- methodA method is a callable function or operation associated with a type, class, or object and invoked through that association.
- moduleA module is a cohesive unit of code or computation that groups related functionality within a larger system and defines a scope or boundary for organizing or sharing it.
Related concepts
- local namespaceincludes · A local namespace is the mapping of names to objects within a particular local scope, such as an executing function or code block.
- moduleproduced by · A module is a cohesive unit of code or computation that groups related functionality within a larger system and defines a scope or boundary for organizing or sharing it.
- name collisionaddresses · A name collision occurs when distinct entities use the same identifier within a shared naming scope, creating ambiguity or conflict.
- dir()used by · dir() is a Python built-in function that returns names available in a namespace or attributes associated with an object, module, or type.
Questions about namespace
What is namespace?
A global namespace is a top-level naming context that binds identifiers defined at the outermost level and distinguishes them from names in nested scopes.
Which Manning books explain namespace?
The Well-Grounded Python Developer: How the pros use Python and Flask, Kubernetes in Action, Second Edition, Google Anthos in Action, The Quick Python Book, Fourth Edition, 100 C++ Mistakes and How to Avoid Them, Clojure: The Essential Reference, Authorization in Action, Python How-To and 14 more.
What should I know before learning namespace?
Manning books that teach namespace usually introduce function, attribute, method and module first.
What kinds of namespace are there?
Kinds of namespace include local namespace.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.





















