ParticleListLike
- plasmapy.particles.particle_collections.ParticleListLike
An
objectis particle-list-like if it can be identified as aParticleListor cast into one.When used as a type hint annotation,
ParticleListLikeindicates that the corresponding argument should represent a sequence of physical particles. Each item in aParticleListLikeobject must be particle-like.Notes
DimensionlessParticleinstances do not uniquely represent a physical particle, and are thus notParticleLikeand cannot be contained in aParticleListLikeobject.See also
Examples
Using
ParticleListLikeas a type hint annotation indicates that an argument or variable should represent a sequence ofParticleLikeobjects.>>> 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]