To get field names with [`fields()`](https://qgis.org/pyqgis/3.2/core/Vector/QgsVectorLayer.html?highlight=vectorlayer#qgis.core.QgsVectorLayer.fields) method or other field properties (`length`, `type`, `comment`, ...) you can use:

<!-- language: python -->

    field_names = [field.name() for field in layer.fields()]
    # ['id', 'attr1', 'attr2', 'attr3']

If you just need names, it's sufficient to use:

<!-- language: python -->

    field_names = layer.fields().names()
    # ['id', 'attr1', 'attr2', 'attr3']