Re: Create a contact book
π > Here at Homeworks Anonymous, the first step is admitting that what you > have is a homework problem. :) > > ChrisA -- punkt.de GmbH Lars Liedtke .infrastructure Kaiserallee 13a 76133 Karlsruhe Tel. +49 721 9109 500 https://infrastructure.punkt.de [email protected] AG Mannheim 108285 GeschΓ€ftsfΓΌhrer: JΓΌrgen Egeling, Daniel Lienert, Fabian Stein -- https://mail.python.org/mailman/listinfo/python-list
RE: Create a contact book
Chris, I think it is time someone set up a business where they do the homework for people for a mere $1,000 or so per hour. Anonymously, of course. And we can refer requests for free homework advice there. Maybe the answer to this request is to suggest they use FACEBOOK which seemingly keeps you in contact and lets you add friends and view them -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Tuesday, October 26, 2021 2:36 AM To: Python Subject: Re: Create a contact book On Tue, Oct 26, 2021 at 5:30 PM anders Limpan wrote: > > i would like to create a contact book were you can keep track of your > friends. With this contact book you will both be able to add friends > and view which friends that you have added. anyone interested in > helping me out with this one ?=) > Here at Homeworks Anonymous, the first step is admitting that what you have is a homework problem. :) This isn't a project, this is something you're doing for a course, and it's not really fair to pretend otherwise :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: New assignmens ...
Op 25/10/2021 om 23:03 schreef Chris Angelico: > On Tue, Oct 26, 2021 at 7:18 AM Antoon Pardon wrote: >> Op 25/10/2021 om 20:39 schreef Chris Angelico: >>> On Tue, Oct 26, 2021 at 5:35 AM Antoon Pardon wrote: By putting limits on the walrus code, you are not reducing complexity, you are increasing it. You are increasing complexity because you can't just reuse the code that handles an ordinary assignment. You now need specific code to limit it's use. >>> What does this code do? >>> >>> while x, y := foo(): >>> ... >>> >>> Is it more complicated or less complicated when arbitrary assignment >>> targets are permitted? >> Well I would guess it would do something similar to >> >> while [x, y := foo()]: >> ... >> > And does it unpack what foo returns? > > Should it? 1) No it doesn't. 2) I don't care. This is IMO not a question of what should or should not, but just a question of deciding how you want to treat this. I guess that since it doesn't unpack already, this behaviour is more or less fixed for futere releases. Should the python developers in the future decide that de walrus operator can unpack things. The above code will not unpack in order to not break already existing code and if you want to unpack one will have to write something like: while [(x, y) := foo()]: ... But the answer to that second question has very little relevance to how complicated the parser will be. It is just deciding which of , or := has a higher precedence. Since that decision has already been more or less made, there is not much to decide here either. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list
RE: New assignmens ...
Why force unpacking? Why not assign a tuple? That would look like a simple assignment: x := (alpha, beta, gamma) And you could access x[0], x[1] and x[2]. I think asking := to support x, y := alpha, beta is a request to address an unnecessary, easily worked around, issue. And as previously pointed out you can still just use = . --- Joseph S. Teledyne Confidential; Commercially Sensitive Business Data -Original Message- From: Chris Angelico Sent: Monday, October 25, 2021 6:25 PM To: Python Subject: Re: New assignmens ... On Tue, Oct 26, 2021 at 9:19 AM dn via Python-list wrote: > Back on-topic, I am slightly curious:- > > aside from 'starting small' with an option to widen/'open-up' later, > is there a particular reason why 'the walrus' has not been made > available (could not be ...?) for use with object-attributes? I can't think of any other reasons. But the one you cite is quite an important one. In order to get real-world usage examples, the feature was rolled out in the restricted form, because threads like this are *exactly* how the value can be judged. So I do not in any way regret that assignment expressions were accepted in their current form, but also, don't be afraid to propose an opening up of the syntax. Be specific, and cite usage examples that would benefit. TBH, I don't think there's a lot of value in multiple-assignment, since it has a number of annoying conflicts of syntax and few viable use-cases. But if you have great examples of "x.y :=" or "x[y] :=", then by all means, post on python-ideas to propose widening the scope. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Create a contact book
Am 26.10.21 um 07:40 schrieb anders Limpan: i would like to create a contact book were you can keep track of your friends. With this contact book you will both be able to add friends and view which friends that you have added. anyone interested in helping me out with this one ?=) Here is how to do it: https://facebook.com/ Christian -- https://mail.python.org/mailman/listinfo/python-list
matrix row comparison and fetch data with numpy
I have 2 matrix with , M and M' , The M' matrix is the result of calculation
"order preserving" of the matrix M so i will explain more by examples , so
here is the matrix M :
M= np.array([
[15,4,-1,9,10,7],
[-4,2,29,11,98,5],
[101,24,3,19,77,53],
[0,88,34,62,13,-9],
[52,93,44,46,24,125],
[0,17,26,8,87,0],
[103,19,52,173,66,24],
[26,78,123,-5,13,41]
])
so lets take the row L1 from the matrix M so the smallest integer is - 1 so we
take the position of -1 from the matrix M which is in the column C3 and write 1
in L1 of the matrix M', and here we go for the other numbers we compare them
and take the right order , in case of similarity we give them the same order ,
this part is looking fine i write a program who take a matrix and calculate the
order preserving of it and show the results in the second matrix , here is my
code :
https://pastebin.com/jpaZfVsB
so the second step is , We will take the columns similar to X% from the matrix
M'
In this case there are two conditions : X% = 100% similar
The number of minimum similar columns : ππππ πππ πππ=2
so from the matrix M' we will compare row by row : L1 to L2 , L2 to L 3 until
we find similar rows and here is the results :
Seed1= {L1 l2 c2 c4 c6}
Seed2= {L1 l3 c1 c3 c5}
Seed3={L3 l6 c2 c4 c5}
Seed4={L4l6 c3 c6}
Seed5= {L7 l8 c3 c5 c6}
In order to build a bi-group , We must combine the seeds with each other: we
will unite the rows of the seed and the intersection of the columns of the seed
By respecting: ππππ πππ πππ = 2
the final results :
Bi-groupe 1={L1 l2 l3 l6 c2 c4}
Bi-groupe2={L1 l3 l7 l8 c3 c5}
Bi-groupe 3={L4 l6 l7 l8 c3 c6}
i just want a function or away to figured out the seeds by rows comparison
and show the bi-groupe results
Many Thanks
--
https://mail.python.org/mailman/listinfo/python-list
Re: Create a contact book
On 2021-10-25 22:40, anders Limpan wrote:
> i would like to create a contact book were you can keep track of
> your friends. With this contact book you will both be able to add
> friends and view which friends that you have added. anyone
> interested in helping me out with this one ?=) --
Python provides the shelve module for just this sort of thing:
import shelve
class Contact:
def __init__(self, name):
self.name = name
self.address = ""
self.phone = ""
with shelve.open("contacts") as db:
dave = Contact("Dave Smith")
dave.address = "123 Main St\nAnytown, NY 12345"
dave.phone = "800-555-1212"
db["dave"] = dave
ellen = Contact("Ellen Waite")
ellen.phone = "+1234567890"
db["ellen"] = ellen
Then at some future point you can use
with shelve.open("contacts") as db:
dave = db["dave"]
print(f"Dave lives at {dave.address}")
ellen = db["ellen"]
print(f"Ellen's phonenumber is {ellen.phonenumber}")
I'll leave to you the details of implementing an actual address-book
out of these parts. Be sure to read the docs for the shelve module
https://docs.python.org/3/library/shelve.html
including the various security warnings and caveats.
-tkc
--
https://mail.python.org/mailman/listinfo/python-list
The task is to invent names for things
Some time ago I watched a video of a Raymond Hettinger talk. In it he recounted answering his son's question of 'what do you do, Dad?' by suggesting that programmers spend much?most of their time thinking of names - and good names are better than "n = name", etc. This theme developed throughout the talk. Have searched, but been unable to re-locate this video. Do you recall the talk? Please advise its URL... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list
How to store the result of df.count() as a new dataframe in Pandas?
Hello, The result of df.count() appears to be a series object. How to store the result of df.count() as a new dataframe in Pandas? That is data anyhow. Regards, David -- https://mail.python.org/mailman/listinfo/python-list
Re: The task is to invent names for things
On 27/10/2021 11.16, Stefan Ram wrote: > dn writes: >> Some time ago I watched a video of a Raymond Hettinger talk. In it he >> recounted answering his son's question of 'what do you do, Dad?' > > The Mental Game of Python - Raymond Hettinger (PyBay 2019) > > Around minute 21, Raymond says: > > |I often, doo, uh, try to describe, uh, computer programming, > |uh, to kids. > | > |How many of you can tell, uh, uh, a child what a, uh, a > |software engineer does? > | > |At least one man, uh, uh, can. - One man who has. > | > |Here's my explanation: > | "The computer gives us words that do ### things. > | What daddy does is make new words to make computers easier to use." > > . An awesome explanation! > > But please help me to understand the word marked "###" above! That was quick. Thank you! (and yes, I had "Bay Piggies" in my head, but after starting to re-watch that video, moved-on because the agenda didn't seem to match) OTOH it is not exactly as I remember (which may say more about me!). Perhaps he re-used the story elsewhere - I shall investigate further... Meantime, the tape will reinforce a 'learning-opportunity' for a certain trainee and his 'algebraic habit'... Your question: Firstly, Raymond often needs to "er" in order to let his mind catch-up with his words. A lot of us do this, not because we've forgotten what to say, but because we're also listening, in QA-mode as it were, and sometimes question our choice of words - ah, back to names/words again! In this case, I'll suggest that he was already struggling with the subject of the sentence - is he talking about 'a programmer' talking to a child, or his own situation in-conversation with his son? Secondly, there is the issue of singular/plural forms - especially when formulating the sentence's object - or final clause. Thus, do I use the singular "does" because "computer" is singular, or should it be the plural "do" because "words" is plural? His first choice was grammatically-correct. Think of the pause as running pytest prior to further execution... Alternately, if your question was to identify the mumbled word, it is (seemed to me to be) "does". Thanks again! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: The task is to invent names for things
On 27/10/2021 11.21, Stefan Ram wrote: > [email protected] (Stefan Ram) writes: >> The Mental Game of Python - Raymond Hettinger (PyBay 2019) >> |What daddy does is make new words to make computers easier to use." > > BTW: It now also reminds me of: > > |What I Do > | > |I build paradigms. > |I work on complex ideas and make up words for them. > |It is the only way. > | > Ted Nelson (1937-) in 1998 or earlier > > , which might precede Raymonds talk. Indeed, this is how we 'invent' jargon - a short-cut to enable subject-specialists (SMEs) to inter-communicate succinctly or more accurately. What really gets me into 'grumpy old man' mode, is the predilection for our TV folk to imitate their foreign peers, or to use their own jargon/slang in a public forum. Over the decades of my career I've listened (as politely as possible) to so many (so, so, many) ordinary-folk complaining that we computer-guys talk gobbledegook, and need to down-shift and explain things in ordinary language. Sometimes this is valid - there is no point in talking to my neighbors about "ternary operators" and certainly "walrus" would create complete misunderstanding. However, a public broadcaster to think it acceptable to use such (of their) terms as "presser" (Press Briefing, or is it Press Release?), only goes to show that IT people (without specific training in (public) communication) aren't 'that bad' after all! Programmers of the world unite! You have nothing to lose but your 0 - or your 1 -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: The task is to invent names for things
On Wed, Oct 27, 2021 at 10:16 AM dn via Python-list wrote: > Programmers of the world unite! > You have nothing to lose but your 0 > - or your 1 Many operations in computing are fully reversible. After you do something, you can undo it. After you assign, you can unassign. And after you ite, you can unite! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: The task is to invent names for things
On 27/10/2021 12.29, Stefan Ram wrote: > dn writes: >> On 27/10/2021 11.16, Stefan Ram wrote: >>> The Mental Game of Python - Raymond Hettinger (PyBay 2019) >>> | "The computer gives us words that do ### things. > ... >> Alternately, if your question was to identify the mumbled word, it is >> (seemed to me to be) "does". > > Thanks! > > Yes, my question was about the word at the place of the > "###". It does not even seem mumbled to me, but pronounced > with certainty and intention. That's why it makes me wonder. > As if there was a term "does things". That is a colloquialism: - my computer does things - my program[me] does stuff The "stuff" is something of a euphemism. In our profession, I would suggest it is used to avoid detail, eg as a 'signal' to a non-IT person that a more detailed answer would likely bore, or 'go over your head'. In PM-circles we identify the beginning and end of a project - the rest of the project plan 'stuff', is known as 'the miracle that happens in the middle'. Want more detail? Do we have more detail? What do I know? If a dog owner said: "my dog does things" it would again be a euphemism, but in this case employed to avoid saying something distasteful, ie that the puppy is not (yet) house-trained. That said, I suspect if you tried to use it in an English (language/literature) essay, the teacher/prof would take exception to such informality, and demand a 'better' noun! Believe it or not, my second trainee-discussion of the day included a question similarly-worded: 'why does the computer/interpreter/run-time do these things?'. Rather than 'literature', I taught this guy one of my favorite excursions into the world of poetry (the specific type of poetic stuff is "doggerel"): I really hate this dumb* machine, I wish that they would sell it. It never does quite what I want, but only what I tell it! * you might regard this word as a euphemism for another Upon which note, and your observation that I am no English-major, it's probably time we went to do things... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: Create a contact book
On 27/10/2021 04.16, Avi Gross via Python-list wrote: > Chris, > > I think it is time someone set up a business where they do the homework for > people for a mere $1,000 or so per hour. Anonymously, of course. And we can > refer requests for free homework advice there. > > Maybe the answer to this request is to suggest they use FACEBOOK which > seemingly keeps you in contact and lets you add friends and view them > > On Tue, Oct 26, 2021 at 5:30 PM anders Limpan wrote: >> >> i would like to create a contact book were you can keep track of your >> friends. With this contact book you will both be able to add friends >> and view which friends that you have added. anyone interested in >> helping me out with this one ?=) >> > > Here at Homeworks Anonymous, the first step is admitting that what you have > is a homework problem. :) This isn't a project, this is something you're > doing for a course, and it's not really fair to pretend otherwise :) > > ChrisA It's a balancing-act: - on the one hand writing (their) code is not helping a trainee to learn (and certainly not in the manner the trainer intended) - on the other, we should try to welcome and encourage new-comers to our list/the Python eco-system. That said, I've often recommended folk switch/also subscribe to the Tutor list, but can't say if many actually did. "Essay Mills" are back in the news in the UK with a proposal to make them completely illegal. The Times Educational Supplement printed an article two~three weeks ago (https://www.timeshighereducation.com/student/advice/tempted-pay-your-essays-here-are-six-reasons-not - likely behind a pay-wall - if so, apologies). The author identified six reasons for not using an Essay Mill: (the labels are his, the summaries beyond them are mine) 1 Harsh penalties - if caught 2. Fool no more - plagiarism software these days is not only comparing 'this work' with others' assignment returns, but this with your other submissions, ie noting if your personal writing style changes! 3. Career impact - how it impacts employment (possibilities) if such is either on your record or becomes evident later 4. On the record - if the 'mill' has your record, what if they're hacked? Do they have better security than the many organisations which have been breached? 5. No guarantee of anonymity - your shadow-author will have a 'hold' over you, forever 6. Bribery - perhaps that essay should be about blackmail, how it could start, and what might be its effects? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: New assignmens ...
Op 25/10/2021 om 18:47 schreef Christman, Roger Graydon: Message: 8 Date: Mon, 25 Oct 2021 11:20:52 +0200 From: Antoon Pardon To: [email protected] Subject: Re: New assignmens ... Message-ID: <[email protected]> Content-Type: text/plain; charset=utf-8; format=flowed On 25/10/2021 11:20, Anton Pardon wrote: Suppose I would like to write a loop as follows: >while ((a, b) := next_couple(a, b))[1]: >do needed calculations What I can do is write it as follows: while [tmp := next_couple(a,b), a := tmp[0], b := tmp[1]][-1]: >do needed calculations I really don't see what is gained by "forcing" me to right the second code over the first. No, nobody is forcing you to right it the second way over the first. Nobody is forcing you to use the walrus operator at all! Instead, I would recommend something more like: while b: do needed calculations (a,b) = next_couple(a,b) But AIU the walrus operator was introduced so we no longer needed, to write such code, with the calculation of the next candidate at the bottom and the test at the top. You just confirmed the walrus operator is not very useful once the next candidate is no longer just a name. -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list
Re: New assignmens ...
Op 26/10/2021 om 19:46 schreef Schachner, Joseph: Why force unpacking? Why not assign a tuple? That would look like a simple assignment: x := (alpha, beta, gamma) And you could access x[0], x[1] and x[2]. I think asking := to support x, y := alpha, beta is a request to address an unnecessary, easily worked around, issue. And as previously pointed out you can still just use = . Because the names usually have meaning, while the tuple has not. And you just confirmed my point that the walrus operator isn't very useful here by suggesting that I should abandon it and use an assignment. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list
