ParticleListLike
- plasmapy.particles.particle_collections.ParticleListLike
An
object
is particle-list-like if it can be identified as aParticleList
or cast into one.When used as a type hint annotation,
ParticleListLike
indicates that the corresponding argument should represent a sequence of physical particles. Each item in aParticleListLike
object must be particle-like.Notes
DimensionlessParticle
instances do not uniquely represent a physical particle, and are thus notParticleLike
and cannot be contained in aParticleListLike
object.See also
Examples
Using
ParticleListLike
as a type hint annotation indicates that an argument or variable should represent a sequence ofParticleLike
objects.>>> from plasmapy.particles import ParticleList, ParticleListLike >>> def contains_only_leptons(particles: ParticleListLike): ... particle_list = ParticleList(particles) ... return all(particle_list.is_category("lepton")) >>> contains_only_leptons(["electron", "muon"]) True
alias of
ParticleList
|Sequence
[str
|int
|integer
|Particle
|CustomParticle
|Quantity
]