Attributes
Attributes[sym]
returns a List
of attributes for sym
.
Attributes[Attributes] := {HoldAll, Listable, Protected}
Simple examples
In[1]:= Attributes[Infinity]
Out[1]= {Protected, ReadProtected}
In[2]:= Attributes[Attributes]
Out[2]= {HoldAll, Listable, Protected}
In[3]:= Attributes[Plus]
Out[3]= {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected}
The default set of attributes is the empty list:
In[4]:= Attributes[undefinedSym]
Out[4]= {}
Further examples
Only symbols can have attributes:
In[1]:= Attributes[2]
Out[1]= Attributes[2]
In[2]:= Attributes[a^2]
Out[2]= Attributes[a^2]