[Tutor] Question

Steven D'Aprano steve at pearwood.info
Sun Dec 10 05:41:04 EST 2017

```Hello Khabbab Zakaria,

On Sun, Dec 10, 2017 at 11:18:16AM +0530, Khabbab Zakaria wrote:
> I am working on a program where I found the line:
> x,y,z = np.loadtext('abcabc.txt', unpack= True, skiprows =1)
> What does the x, y, z thing mean?

"x, y, z = ..." is iterable unpacking. The right hand side has to be an
iterable (any object that can be iterated over in a for-loop) such as a
list, a tuple, a set, or similar. For example:

x, y, z = [1, 2, 3]

will set x = 1, y = 2, z = 3. It is an error if the object on the right
hand side has too few or too many items:

a, b, c, d, e = (1, 2, 3) # Too few items

a, b, c, d, e = (1, 2, 3, 4, 5, 6, 7)  # Too many items

> What does the unpack= True mean?

I'm afraid you will need to read the numpy documentation for that. I
tried looking at it myself, but the version of numpy I have seems to be
too old:

py> import numpy as np
{"ft_lang_label":"__label__en","ft_lang_prob":0.83335054,"math_prob":0.8548838,"size":1160,"snap":"2019-26-2019-30","text_gpt3_token_len":390,"char_repetition_ratio":0.082179934,"word_repetition_ratio":0.0349345,"special_character_ratio":0.34224138,"punctuation_ratio":0.21768707,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9513017,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-06-18T17:17:07Z\",\"WARC-Record-ID\":\"<urn:uuid:22d1aa2f-f622-4a3a-bd9b-2803a47a8bc7>\",\"Content-Length\":\"3858\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:5d98f2a9-2f3d-403e-9d85-9502da5e5b92>\",\"WARC-Concurrent-To\":\"<urn:uuid:4946a75c-cdcd-4a6e-8335-508c25676fb4>\",\"WARC-IP-Address\":\"188.166.95.178\",\"WARC-Target-URI\":\"https://mail.python.org/pipermail/tutor/2017-December/112420.html\",\"WARC-Payload-Digest\":\"sha1:UYLNBO7MYRR6QFKGYA72AC5M6CPNBQQO\",\"WARC-Block-Digest\":\"sha1:GPZFHXKCKLXXVEB36LFEPEECNW5DBLQO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-26/CC-MAIN-2019-26_segments_1560627998808.17_warc_CC-MAIN-20190618163443-20190618185443-00053.warc.gz\"}"}