*** jelkner has quit (Quit: Leaving) | 12:28 | |
*** tboimah has quit (Quit: Leaving) | 13:24 | |
*** ubuntourist has quit (None) | 14:01 | |
*** ubuntourist has quit (None) | 14:10 | |
ubuntourist | I was on at 9:00 and no one was here. I checked again at 9:10 and no one was here. | 14:38 |
---|---|---|
tboimah | Good day ubuntourist | 14:41 |
mulbah | Good morning Mr. Cole | 14:42 |
ubuntourist | tboimah, mulbah, dcammue Hi. | 14:42 |
dcammue | How are you ubuntourist | 14:42 |
mulbah | How are you Mr. Cole | 14:42 |
ubuntourist | With Python, I don't really have a lesson plan. So, I'm only on to take questions... | 14:43 |
ubuntourist | ...unless I think of something clever to write about. Today, I don't have any clever thoughts. | 14:43 |
ubuntourist | mulbah, dcammue, tboimah I'm doing well. I hope you are all doing well. | 14:43 |
dcammue | exactly Mr. Cole | 14:44 |
ubuntourist | How goes your progress with Python? Have you tried working together to make a timer for questions? | 14:45 |
tboimah | we are still working on that | 14:46 |
ubuntourist | Good. I think that's the best way to learn: Find something you actually need, and fight with the code until it does what you want. | 14:46 |
mulbah | Mr. Cole I want you to try our ability to ask us a question in python | 14:47 |
ubuntourist | mulbah, If you mean you want me to ask you questions to see what you know, I don't really do that. | 14:48 |
dcammue | can I ask? | 14:49 |
ubuntourist | mulbah, Write code. Put it in a git repository. Put it up on Codeberg.org or GitLab.com. Put in good comments. Those are the best proof that you are actually learning and applying the knowledge. | 14:49 |
ubuntourist | dcammue, sure. | 14:49 |
dcammue | can python do a random selection with a words or a question? | 14:50 |
ubuntourist | dcammue, yes... but... This is where being able to read the Python Library Reference manual is REALLY helpful. | 14:50 |
dcammue | okay | 14:51 |
ubuntourist | dcammue, random functions are not part of the built-in core functions of Python. You need to import the random library module. | 14:51 |
ubuntourist | dcammue, hold a sec... | 14:51 |
ubuntourist | https://docs.python.org/3/library/random.html#module-random | 14:52 |
dcammue | Thanks | 14:53 |
ubuntourist | The Python Library Reference Manual is not the easiest thing to read, but it is INVALUABLE ! You will almost certainly need it... a lot. | 14:53 |
dcammue | I save it to bookmark | 14:53 |
dcammue | okay | 14:54 |
ubuntourist | Also, I was mentioning to scooper and tboimah about StackOverflow.com which is a great place to search for answers. | 14:54 |
*** mulbah has quit (Read error: Connection reset by peer) | 14:55 | |
ubuntourist | On that web site, use "tags" as search terms. A "tag" is a word enclosed in brackets. | 14:55 |
ubuntourist | So I would go to https://stackoverflow.com/ and use the search terms "[python]" and "[random]" -- without quotes. | 14:56 |
dcammue | okay | 14:56 |
ubuntourist | The first question that turned up when I did it just now was: | 14:56 |
ubuntourist | "How can I randomly select (choose) an item from a list (get a random element)?" | 14:57 |
ubuntourist | the question has 2355 "up" votes, which means 2355 people liked the question. | 14:58 |
ubuntourist | It has 18 answers, and the best answer got 3403 likes. | 14:58 |
*** tboimah has quit (Remote host closed the connection) | 15:01 | |
*** dcammue has quit (Remote host closed the connection) | 15:01 | |
*** mulbah07_ has quit (Remote host closed the connection) | 15:01 | |
*** dcammue has quit (None) | 15:03 | |
dcammue | okay /me back | 15:04 |
ubuntourist | (The answers on StackOverflow are often shorter and less complete, but include examples that you can try easily.) | 15:04 |
dcammue | so what the utf-8 really do in python | 15:05 |
ubuntourist | dcammue, do you mean the special comment "# -*- coding:utf-8 -*-" | 15:06 |
dcammue | I think is the same as encoding=utf-8 | 15:08 |
ubuntourist | dcammue, Ah. That's different. Thanks for the clarification. | 15:08 |
ubuntourist | (The special comment really doesn't do anything... except that some editors like vim and emacs read it and make use of it. | 15:09 |
ubuntourist | the encoding=utf-8 is, for me, a bit of an advanced topic but I will try to explain. | 15:09 |
ubuntourist | In the time of the dinosaurs like me, everybody had to code the way that Americans code. That meant | 15:10 |
ubuntourist | English words and the American alphabet. No accented characters, no Chinese or Arabic, etc. | 15:11 |
ubuntourist | You were limited to 128 characters -- 32 control characters, 32 numbers and punctuation, 32 UPPER CASE plus a few more punctuation marks, and 32 lower case and a few more punctuation marks. | 15:12 |
ubuntourist | ASCII - the American Standard Code for Information Interchange | 15:13 |
ubuntourist | (In your terminal window, you can type "man ascii" to see a table of ASCII values.) | 15:13 |
dcammue | should I try it now? | 15:14 |
ubuntourist | dcammue, sure. Don't study it deeply right now but a quick look now is a good idea. | 15:15 |
ubuntourist | 128 characters is nice because it means that you only need 8 bits. One byte could hold numeric values to represent "all" of the keystroke combinations on your keyboard. | 15:17 |
ubuntourist | But many people were deeply unhappy that their own languages could not be represented. So an international committee | 15:18 |
ubuntourist | invented Unicode. Unicode is 16-bits. So now, 65,536 characters can be represented. | 15:19 |
ubuntourist | And other specifications for Unicode mean that it can even do more than that. But it gets too technical. | 15:20 |
ubuntourist | UTF-8 = Unicode Transformation Format – 8-bit | 15:21 |
dcammue | okay | 15:22 |
ubuntourist | You can think of UTF-8 as a compromise: If you still really only need 128 characters, like most Americans, and most users of English, | 15:22 |
ubuntourist | using full Unicode wastes space: Every character takes up two bytes when only one is needed. | 15:23 |
ubuntourist | UTF-8 is basically a way of saying that it is Unicode but it is constrained to 8 bits. It is a subset of Unicode. | 15:24 |
ubuntourist | https://en.wikipedia.org/wiki/UTF-8 | 15:24 |
ubuntourist | So. encoding="UTF-8"... This is where I always need to check my understanding. jelkner can probably explain this better and more correctly. | 15:25 |
ubuntourist | So, try to do your own research but here's my understanding: | 15:25 |
ubuntourist | Back when there was only 128 values, the words "character" and "byte" were almost synonymous. | 15:26 |
ubuntourist | Characters were always one byte long. | 15:26 |
ubuntourist | But when Unicode and UTF-8 were created, sometimes "character" meant 8 bits (one byte) and sometimes it meant 16 bits (two bytes). | 15:27 |
ubuntourist | That means, if you have a section of computer memory with lots of bytes, and you know it is supposed to be text, not integers or some other data, | 15:29 |
ubuntourist | you do not have a way of knowing: Is this string of 20 bytes 20 ASCII or UTF-8 letters? Or is it 10 full Unicode letters? | 15:30 |
ubuntourist | By using encoding="UTF-8" you are EXPLICITLY telling Python how to interpret a string of bytes. In this case, those 20 bytes are, in fact 20 alphanumeric characters, not 10. | 15:31 |
ubuntourist | Onc again, docs.python.org can help: | 15:32 |
ubuntourist | https://docs.python.org/3/howto/unicode.html#encodings | 15:32 |
ubuntourist | I mentioned that Unicode uses 16 bits, but I also said there were modifications to allow it to include even more. | 15:33 |
dcammue | yes | 15:35 |
ubuntourist | According to the page I just mentioned, full Unicode is actually now 21-bits... So more than two bytes but not fully three. | 15:35 |
ubuntourist | and it can hold 1,114,111 alphanumeric characters! Over 1 MILLION unique characters! | 15:36 |
ubuntourist | Room for all kinds of alphabets, including emoji, special math and science symbols, drawing characters, music characters... | 15:37 |
ubuntourist | But the simple answer, from a purely practical standpoint is "when you are working with Python byte strings, and the bytes are representing text, | 15:38 |
ubuntourist | you will PROBABLY almost always want to encode as UTF-8... Unlesss you start gettting a lot of contracts for web sites or applications that are not using English. | 15:40 |
ubuntourist | If you do get such contracts, you will probably have help from your business partner, unless you have in-house experts in other languages." | 15:40 |
ubuntourist | ACTION is done. | 15:40 |
dcammue | Thanks so much I have a little understanding on it | 15:41 |
ubuntourist | dcammue, me too. 😉 | 15:42 |
dcammue | small small as time goes by I will fully understand that better | 15:42 |
ubuntourist | dcammue, me too. 😉 small, small. Every time I need to worry about byte strings, I need to go back to docs.python.org | 15:43 |
ubuntourist | and re-read everything about bytes and encoding="..." | 15:43 |
dcammue | okay | 15:44 |
dcammue | that's it | 15:44 |
ubuntourist | In my work, I almost never needed to work with byte strings and encoding. So, when I needed to do it, I had already forgotten how it all works. | 15:45 |
ubuntourist | jelkner has a better understanding here. Possibly from working with many Spanish-speakers who need accented characters. | 15:45 |
ubuntourist | (It's important stuff to learn, but Unicode and UTF-8 were not invented until I had been programming for a very long time.) | 15:46 |
ubuntourist | You will have an easier time learning it because you are starting out with the technology already being common. | 15:47 |
dcammue | Yeah, the brine can some times forget about what it learned in the past, but as you go back to it, it will pick it quicker than before | 15:47 |
ubuntourist | (I thiink you'll have an easier time learning it. If you do, you can write a good explanation for me to read. Maybe it will be better than the Python documentation.) | 15:48 |
ubuntourist | ACTION doesn't have anything else to talk about and it is almost 11:00 my time... | 15:49 |
dcammue | so I guess when you do re-read it you will get better understanding than before | 15:49 |
ubuntourist | dcammue, yep. | 15:49 |
dcammue | okay | 15:49 |
dcammue | Then have a nice day ubuntourist | 15:49 |
dcammue | see you the next Monday | 15:50 |
ubuntourist | dcammue, you too. (And mulbah and tboimah.) | 15:50 |
ubuntourist | See you Monday. | 15:50 |
tboimah | Okay thank for today ununtourist | 15:50 |
dcammue | Sweet | 15:50 |
tboimah | *ubuntourist | 15:50 |
*** ubuntourist has quit (Quit: Leaving) | 15:51 | |
*** dcammue has quit (Quit: Leaving) | 15:51 | |
*** mulbah has quit (Quit: Leaving) | 16:11 | |
*** tboimah has quit (Read error: Connection reset by peer) | 16:31 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!