Re: How do you insert an item into a dictionary (in python 3.7.2)?

2019-06-29 Thread Michael Torrie
On 06/28/2019 09:06 AM, CrazyVideoGamez wrote: > How do you insert an item into a dictionary? For example, I make a dictionary > called "dictionary". > > dictionary = {1: 'value1', 2: 'value3'} > > What if I wanted to add a value2 in the middle of value1 and value3? How about: dict[1.5] = 'valu

Re: Use global, or not

2019-06-29 Thread Michael Torrie
On 06/29/2019 05:42 AM, Cecil Westerhof wrote: > That was the other possibility I was thinking about. And that would be > maybe better. Because I now do things like: > global_dict['messages']['created'].format(len(filepathArr)) > > much better would be: > instance.created(len(filepathArr))

Re: Use global, or not

2019-06-29 Thread DL Neil
On 29/06/19 11:42 PM, Cecil Westerhof wrote: DL Neil writes: On 29/06/19 1:44 AM, Cecil Westerhof wrote: I have written a GUI program where I have quit a few global variables. I did not like this, so I now use one global dict. Something like: global global_dict ... Is that an acceptab

Re: Plumbing behind super()

2019-06-29 Thread Thomas Jollans
On 30/06/2019 01:15, adam.pre...@gmail.com wrote: Whoops. Now I need to figure out how the interpreter knows that change_a is a method and knows what self to feed it. I'm assuming that's in the cell variables similar to what super()'s doing as explained here. I haven't implemented cell variab

Re: change spacing to two instead of four with pep8 or flake8?

2019-06-29 Thread Cameron Simpson
On 29Jun2019 10:19, Malcolm Greene wrote: I've also taken to having my files auto-formatted with yapf on save ... @Cameron: Have you considered black at all and if so, what are your thoughts? I did consider black. Its core selling point was its total inflexibility. Use this and stop _cari

Re: Plumbing behind super()

2019-06-29 Thread adam . preble
Thanks for the replies from everybody. It looks like I should double check super_init and see what truck is coming from that which will hit me with a gotcha later. I'm very naively right now plucking the class from my locals and I was able to proceed in the very, very short term. I think I woul

Re: Do I need a parser?

2019-06-29 Thread Alan Meyer via Python-list
On 6/29/19 8:39 AM, josé mariano wrote: Dear all, I'm sure that this subject has been addressed many times before on this forum, but my poor knowledge of English and of computer jargon and concepts results on not being able to find the answer i'm looking for when I search the forum. So here i

Re: Handle foreign character web input

2019-06-29 Thread Jon Ribbens via Python-list
On 2019-06-28, Chris Angelico wrote: > On Sat, Jun 29, 2019 at 6:31 AM Tobiah wrote: >> A guy comes in and enters his last name as RÖnngren. >> >> So what did the browser really give me; is it encoded >> in some way, like latin-1? Does it depend on whether >> the name was cut and pasted from a W

Re: Handle foreign character web input

2019-06-29 Thread Alan Meyer via Python-list
On 6/28/19 4:25 PM, Tobiah wrote: A guy comes in and enters his last name as RÖnngren. So what did the browser really give me; is it encoded in some way, like latin-1?  Does it depend on whether the name was cut and pasted from a Word doc. etc? Should I handle these internally as unicode?  Right

Re: Do I need a parser?

2019-06-29 Thread bob gailer
I might be able to help. I'd need to understand a bit more about the configuration and scripting languages. Do you have any reference material? Or some way to look up the titration device on the internet? -- Bob Gailer -- https://mail.python.org/mailman/listinfo/python-list

Re: Handle foreign character web input

2019-06-29 Thread Richard Damon
On 6/29/19 3:19 AM, Thomas Jollans wrote: > On 28/06/2019 22:25, Tobiah wrote: >> A guy comes in and enters his last name as RÖnngren. > With a capital Ö in the middle? That's unusual. >> >> So what did the browser really give me; is it encoded >> in some way, like latin-1?  Does it depend on wheth

Re: change spacing to two instead of four with pep8 or flake8?

2019-06-29 Thread Malcolm Greene
> I've also taken to having my files auto-formatted with yapf on save ... @Cameron: Have you considered black at all and if so, what are your thoughts? Thanks, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Handle foreign character web input

2019-06-29 Thread Thomas Jollans
On 28/06/2019 22:25, Tobiah wrote: A guy comes in and enters his last name as RÖnngren. With a capital Ö in the middle? That's unusual. So what did the browser really give me; is it encoded in some way, like latin-1?  Does it depend on whether the name was cut and pasted from a Word doc. etc?

Re: Do I need a parser?

2019-06-29 Thread Thomas Jollans
On 29/06/2019 14:39, josé mariano wrote: Dear all, I'm sure that this subject has been addressed many times before on this forum, but my poor knowledge of English and of computer jargon and concepts results on not being able to find the answer i'm looking for when I search the forum. So here

Do I need a parser?

2019-06-29 Thread josé mariano
Dear all, I'm sure that this subject has been addressed many times before on this forum, but my poor knowledge of English and of computer jargon and concepts results on not being able to find the answer i'm looking for when I search the forum. So here is my problem: I have this open source pro

Re: Use global, or not

2019-06-29 Thread Cecil Westerhof
DL Neil writes: > On 29/06/19 1:44 AM, Cecil Westerhof wrote: >> I have written a GUI program where I have quit a few global variables. >> I did not like this, so I now use one global dict. Something like: >> global global_dict > ... > >> Is that an acceptable way to do this? > > > If it wor