Need help understanding list structure
Ben Finney
ben+python at benfinney.id.au
Mon May 2 19:43:48 EDT 2016
moa47401 at gmail.com writes:
> Am I correct in assuming that parsing a large text file would be
> quicker returning pointers instead of strings?
What do you mean by “return a pointer”? Python doesn't have pointers.
In the Python language, a container type (such as ‘set’, ‘list’, ‘dict’,
etc.) contains the objects directly. There are no “pointers” there; by
accessing the items of a container, you access the items directly.
What do you mean by “would be quicker”? I am concerned you are seeking
speed of the program at the expense of understandability and clarity of
the code.
Instead, you should be writing clear, maintainable code.
*Only if* the clear, maintainable code you write then actually ends up
being too slow, should you then worry about what parts are quick or slow
by *measuring* the specific parts of code to discover what is actually
occupying the time.
--
\ “All television is educational television. The question is: |
`\ what is it teaching?” —Nicholas Johnson |
_o__) |
Ben Finney
More information about the Python-list
mailing list