Detecting a cycle in a graph

2018-01-14 Thread Frank Millman
rely on it being 'obvious'. Maybe there is no logical way of identifying it. I am sure you will need more details if you want to assist, but maybe there is some literature you can point me to that explains these things in more detail. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Detecting a cycle in a graph

2018-01-14 Thread Frank Millman
"Steven D'Aprano" wrote in message news:p3f9uh$ar4$1...@blaine.gmane.org... On Sun, 14 Jan 2018 10:30:31 +0200, Frank Millman wrote: > I can detect a cycle in a path. It is possible for there to be more than > one gateway in the path. I want to identify the gateway that

Re: Detecting a cycle in a graph

2018-01-14 Thread Frank Millman
"Christian Gollwitzer" wrote in message news:p3gh84$kfm$1...@dont-email.me... Am 14.01.18 um 22:04 schrieb Christian Gollwitzer: > Am 14.01.18 um 09:30 schrieb Frank Millman: >> I need to detect when a 'cycle' occurs - when a path loops back on >> itself and

Re: Detecting a cycle in a graph

2018-01-15 Thread Frank Millman
"MRAB" wrote in message news:1f67363c-4d2a-f5ac-7fa8-b6690ddba...@mrabarnett.plus.com... On 2018-01-15 06:15, Frank Millman wrote: > I start my cycle-detection with a node with 0 incoming connections. > > def find_cycle(node, path): > for output in node.outputs: &

Why no '|' operator for dict?

2018-02-04 Thread Frank Millman
ct([(k, v) for k, v in dict_1.items()] + [(k, v) for k, v in dict_2.items()]) {1: 'one', 2: 'two', 3: 'three'} So I have 2 questions - 1. Is there any particular reason why '|' is not supported? 2. Is there a better way to do what I want? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Why no '|' operator for dict?

2018-02-05 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidkp3ls4s-zi3ax6no-68kw4_xdozvwa-cj+oz+apqr...@mail.gmail.com... On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman wrote: > So I have 2 questions - > > 1. Is there any particular reason why '|' is not supported? '|&#x

list indices must be integers or slices, not str

2022-07-20 Thread Frank Millman
> >>> '{x[1]}'.format(**vars()) '1' >>> >>> '{x[-1]}'.format(**vars()) Traceback (most recent call last):   File "", line 1, in TypeError: list indices must be integers or slices, not str >>> Can anyone explain this

Re: list indices must be integers or slices, not str

2022-07-20 Thread Frank Millman
On 2022-07-20 11:37 AM, Chris Angelico wrote: On Wed, 20 Jul 2022 at 18:34, Frank Millman wrote: Hi all C:\Users\E7280>python Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits"

Re: list indices must be integers or slices, not str

2022-07-20 Thread Frank Millman
On 2022-07-20 12:31 PM, Frank Millman wrote: On 2022-07-20 11:37 AM, Chris Angelico wrote: On Wed, 20 Jul 2022 at 18:34, Frank Millman wrote: Hi all C:\Users\E7280>python Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32 Type "help"

Re: list indices must be integers or slices, not str

2022-07-21 Thread Frank Millman
On 2022-07-20 4:45 PM, Chris Angelico wrote: On Wed, 20 Jul 2022 at 23:50, Peter Otten <__pete...@web.de> wrote: I found https://peps.python.org/pep-3101/ """ PEP 3101 – Advanced String Formatting ... An example of the ‘getitem’ syntax: "My name is {0[name]}".format(dict(name='Fred')) It sh

Re: Trying to understand nested loops

2022-08-05 Thread Frank Millman
not, feel free to come back with more questions. BTW, there is an indentation error in your original post - line 5 should line up with line 4. It is preferable to copy/paste your code into any messages posted here rather than type it in, as that avoids the possibility of any typos. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: To clarify how Python handles two equal objects

2023-01-14 Thread Frank Millman
largely independently of the names that are or are not referencing the objects. My 'aha' moment came when I understood that a python object has only three properties - a type, an id, and a value. It does *not* have a name. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

asyncio questions

2023-01-26 Thread Frank Millman
nner I have not figured out how to adapt my code to use this new approach. Any suggestions appreciated. Frank Millman P.S. Might it be better to ask these questions on the Async_SIG Discussion Forum? -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio questions

2023-01-27 Thread Frank Millman
On 2023-01-26 7:16 PM, Dieter Maurer wrote: Frank Millman wrote at 2023-1-26 12:12 +0200: I have written a simple HTTP server using asyncio. It works, but I don't always understand how it works, so I was pleased that Python 3.11 introduced some new high-level concepts that hide the gory de

Re: asyncio questions

2023-01-27 Thread Frank Millman
On 2023-01-27 2:14 PM, Frank Millman wrote: I have changed it to async, which I call with 'asyncio.run'. It now looks like this -     server = await asyncio.start_server(handle_client, host, port)     await setup_companies()     session_check = asyncio.create_task(     chec

Re: Changing the original SQLite version to the latest

2023-02-14 Thread Frank Millman
On 2023-02-15 5:59 AM, Thomas Passin wrote: > > "Download the latest release from http://www.sqlite.org/download.html > and manually copy sqlite3.dll into Python's DLLs subfolder." > I have done exactly this a number of times and it has worked for me. Frank Millman

etree, gzip, and BytesIO

2021-01-20 Thread Frank Millman
ee.parse(gf) to convert to an etree object It works. But I don't know what goes on under the hood, so I don't know if this achieves anything. If any of the steps involves decompressing the data and storing the entire string in memory, I may as well stick to my present approach. Any

Re: name for a mutually inclusive relationship

2021-02-24 Thread Frank Millman
I use for this arrangement is 'sub-types'. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Question about generators

2021-03-05 Thread Frank Millman
I expected. >>> >>> s = [] >>> s.append(((b, c) for b, c in a)) >>> s [ at 0x019FC3F863C0>] >>> I expected the same as the first one. I understand the concept that a generator does not return a value until you call next() on it, but I have

Re: Question about generators

2021-03-05 Thread Frank Millman
On 2021-03-06 8:21 AM, Frank Millman wrote: Hi all This is purely academic, but I would like to understand the following - >>> >>> a = [('x', 'y')] >>> >>> s = [] >>> for b, c in a: ...   s.append((b, c)) ... >>>

Re: Yield after the return in Python function.

2021-04-05 Thread Frank Millman
#x27;Calling' a generator function does not execute the function, it returns a generator object. You have to iterate over the generator object (e.g. by calling next() on it) in order to execute the function and return values. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Fun Generators

2021-04-22 Thread Frank Millman
y *fun* generators people may have seen or written? Not so much the cool or clever ones. Or the mathematical ones (e.g. fib). Something more inane and "fun". But still showcasing generators uniqueness. Short and simple is good. Thanks in advance! Have you looked at this? http://www.da

Negative subscripts

2021-11-26 Thread Frank Millman
item in x[:-y] if y else x: ...    [do stuff] But in my actual program, both x and y are fairly long expressions, so the result is pretty ugly. Are there any other techniques anyone can suggest, or is the only alternative to use if...then...else to cater for y = 0? Thanks Frank Millman -- ht

Re: Negative subscripts

2021-11-26 Thread Frank Millman
On 2021-11-26 11:17 AM, Frank Millman wrote: Hi all In my program I have a for-loop like this - >>> for item in x[:-y]: ...    [do stuff] 'y' may or may not be 0. If it is 0 I want to process the entire list 'x', but of course -0 equals 0, so it returns an empt

Re: Negative subscripts

2021-11-26 Thread Frank Millman
On 2021-11-26 11:24 PM, dn via Python-list wrote: On 26/11/2021 22.17, Frank Millman wrote: In my program I have a for-loop like this - for item in x[:-y]: ...    [do stuff] 'y' may or may not be 0. If it is 0 I want to process the entire list 'x', but of course -0 equ

A bit of nostalgia

2022-01-30 Thread Frank Millman
ing in assembler. I recall my boss telling me that the ICL assembler was called PLAN, which was an acronym, but I forget what it stood for. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

One-liner to merge lists?

2022-02-22 Thread Frank Millman
7;, 'fff', 'ggg'] I can also do this - >>> from itertools import chain >>> a = list(chain(*d.values())) >>> a ['aaa', 'bbb', 'ccc', 'fff', 'ggg'] >>> Is there a simpler way? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: One-liner to merge lists?

2022-02-22 Thread Frank Millman
On 2022-02-22 11:30 AM, Chris Angelico wrote: On Tue, 22 Feb 2022 at 20:24, Frank Millman wrote: Hi all I think this should be a simple one-liner, but I cannot figure it out. I have a dictionary with a number of keys, where each value is a single list - >>> d = {1: ['aaa

Re: One-liner to merge lists?

2022-02-22 Thread Frank Millman
On 2022-02-22 5:45 PM, David Raymond wrote: Is there a simpler way? d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']} [a for b in d.values() for a in b] ['aaa', 'bbb', 'ccc', 'fff', 'ggg'] Now that's what I was looking for. I am not saying that I will use it, but as an academic exercis

Alternatives to XML?

2016-08-24 Thread Frank Millman
rgs: "_param.auto_party_id" not_exists: literal: _value: "" _src: "_param.auto_party_id" _op: is_not _tgt: "$None" This seems even worse from a readability point of view. The arguments to 'compare' are a long way away from the block to be executed. Can anyone offer an alternative which is closer to my original intention? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Alternatives to XML?

2016-08-24 Thread Frank Millman
"Frank Millman" wrote in message news:npkcnf$kq7$1...@blaine.gmane.org... Hi all I have mentioned in the past that I use XML for storing certain structures 'off-line', and I got a number of comments urging me to use JSON or YAML instead. Can anyone offer an alterna

Re: Alternatives to XML?

2016-08-24 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmq2bcQPmQ9itVvZrBZJPcbYe5z6vDpKGYQj=8h+qkv...@mail.gmail.com... On Thu, Aug 25, 2016 at 3:33 PM, Frank Millman wrote: @Peter/Chris > I don't understand - please explain. > > If I store the business rule in Python code, ho

Re: Alternatives to XML?

2016-08-25 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmof_sXqax0Ury5LsBEj7cdFv92WiWKbfvAC+bM=hwt...@mail.gmail.com... Sounds to me like you have two very different concerns, then. My understanding of "GUI" is that it's a desktop app running on the user's computer, as opposed to some sort of client/ser

Re: Alternatives to XML?

2016-08-25 Thread Frank Millman
"Frank Millman" wrote in message news:nplvvl$ci2$1...@blaine.gmane.org... Hi all I have mentioned in the past that I use XML for storing certain structures 'off-line', and I got a number of comments urging me to use JSON or YAML instead. Can anyone offer an alterna

Re: Alternatives to XML?

2016-08-25 Thread Frank Millman
"Peter Otten" wrote in message news:npmti0$qvu$1...@blaine.gmane.org... Frank Millman wrote: > At the risk of disappointing some of you, this is how I am going to > proceed. 'Tis too late for me to stop ;) > The problem that prompted this thread was the

Re: Alternatives to XML?

2016-08-25 Thread Frank Millman
"Peter Otten" wrote in message news:npn25e$s5n$1...@blaine.gmane.org... Frank Millman wrote: As you have to keep the "<", why bother? If you mean why don't I convert the '<' to '<', the answer is that I do - I just omitted to say so. H

Re: Alternatives to XML?

2016-08-26 Thread Frank Millman
"Joonas Liik" wrote in message news:cab1gnpqnjdenaa-gzgt0tbcvwjakngd3yroixgyy+mim7fw...@mail.gmail.com... On 26 August 2016 at 08:22, Frank Millman wrote: > > So this is my conversion routine - > > lines = string.split('"') # split on attributes > fo

Re: Alternatives to XML?

2016-08-26 Thread Frank Millman
"Joonas Liik" wrote in message news:cab1gnptp0gd4s4kx07r1ujrnuxtoij4vf5unye1cfr_y0xv...@mail.gmail.com... something like.. (untested) def escape(untrusted_string): ''' Use on the user provided strings to render them inert for storage escaping & ensures that the user cant type sth lik

Re: [Bulk] Re: Alternatives to XML?

2016-08-26 Thread Frank Millman
"Roland Koebler" wrote in message news:20160826140213.GA17438@localhost... Hi, OMG! So, you have a fileformat, which looks like XML, but actually isn't XML, and will break if used with some "real" XML. I don't want to pursue this too much further, but I would like to point out that my fo

How to extend a tuple of tuples?

2016-09-08 Thread Frank Millman
immutable, and that all of the above operations create a new tuple. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: How to extend a tuple of tuples?

2016-09-09 Thread Frank Millman
"Frank Millman" wrote in message news:nqtlue$unj$1...@blaine.gmane.org... Assume you have a tuple of tuples - a = ((1, 2), (3, 4)) You want to add a new tuple to it, so that it becomes - ((1, 2), (3, 4), (5, 6)) Thanks all. The one I was looking for was a +=

Re: How to extend a tuple of tuples?

2016-09-09 Thread Frank Millman
"Ned Batchelder" wrote in message news:44e067ce-f499-4ca8-87bd-94b18dfc0...@googlegroups.com... On Friday, September 9, 2016 at 6:13:37 AM UTC-4, Frank Millman wrote: > "Frank Millman" wrote in message news:nqtlue$unj$1...@blaine.gmane.org... > > The one I was lo

Is it possible to use 'groupby' asynchronously?

2016-10-06 Thread Frank Millman
this is doable at all, or is groupby not designed for this. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: function call questions

2016-10-19 Thread Frank Millman
;a': {}} id(t) 2542235910088 It has also rebound 'r' so that it now references the new empty dictionary that has been inserted. r {} id(r) 2542234429896 t['a'] {} id(t['a']) 2542234429896 Now continue this process with r = r.setdefault('b', {}), and watch what happens. Hopefully this will help you to understand. Feel free to ask further if not sure. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: function call questions

2016-10-20 Thread Frank Millman
wrote in message news:01cfd810-0561-40b1-a834-95a73dad6...@googlegroups.com... 在 2016年10月20日星期四 UTC+8下午1:32:18,Frank Millman写道: wrote in message news:5506e4d8-bd1d-4e56-8d1b-f71fa8293...@googlegroups.com... > Let's see if I can explain. I am using 't' and 'r' i

Re: function call questions

2016-10-21 Thread Frank Millman
"Anssi Saari" wrote in message news:vg3wph2i3dt@coffee.modeemi.fi... OK, so what happens is that now t references the dictionary with {'a': {}} and r references the empty dict inside that. So when we assign to r again, it's the empty dict inside t (the one accessed by key 'a') that change

Re: function call questions

2016-10-22 Thread Frank Millman
wrote in message news:2853d778-857e-46fc-96a0-8d164c098...@googlegroups.com... 在 2016年10月20日星期四 UTC+8下午11:04:38,Frank Millman写道: wrote in message news:01cfd810-0561-40b1-a834-95a73dad6...@googlegroups.com... Hi Frank, thanks for your kind help. What confused me is at this line: >&

Re: function call questions

2016-10-22 Thread Frank Millman
wrote in message news:9c91a4cf-1f3e-43b3-b75c-afc96b0b4...@googlegroups.com... I have read Anssi's post already before I sent the post. To be frankly, I can't understand why he got the right answer. I'm sorry for my silly. "So when we assign to r again, it's the empty dict inside t (the one acc

Is this pythonic?

2016-11-23 Thread Frank Millman
l_with_comp, perform the computation, then add the following - self.getval = self._getval return self._getval() What is the verdict? -1, 0, or +1? Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Is this pythonic?

2016-11-23 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87inrer0dl@elektro.pacujo.net... "Frank Millman" : > What is the verdict? -1, 0, or +1? Perfectly cromulent, run-of-the-mill Python code. A new word to add to my vocabulary - thanks :-) Frank -- https://mail.pyth

Re: Is this pythonic?

2016-11-23 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87inrer0dl@elektro.pacujo.net... "Frank Millman" : > 3. When instantiating an object, check if it would need computation - >if computation_required: >self.getval = self._getval_with_comp >else: >

Re: Is this pythonic?

2016-11-23 Thread Frank Millman
"Frank Millman" wrote in message news:o13meh$p2g$1...@blaine.gmane.org... 3. When instantiating an object, check if it would need computation - if computation_required: self.getval = self._getval_with_comp else: self.getval = self._getval 4. In _getval

Re: Is this pythonic?

2016-11-23 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmqGEwHPVyrR+Ti9bV=S5MsLt3nquF4TvE=xpees188...@mail.gmail.com... On Wed, Nov 23, 2016 at 11:27 PM, Frank Millman wrote: > > @Chris >> >> This strongly suggests that str(x) is the wrong way to get the >> informatio

Re: Is this pythonic?

2016-11-23 Thread Frank Millman
"Steve D'Aprano" wrote in message news:583653bb$0$1603$c3e8da3$54964...@news.astraweb.com... Even if the computation of the memoised value is done asynchronously, you can easily split the computation off to a separate method (as you already talked about doing!) and make getval() block until it

Re: Is this pythonic?

2016-11-23 Thread Frank Millman
"Steven D'Aprano" wrote in message news:58368358$0$1513$c3e8da3$54964...@news.astraweb.com... On Thursday 24 November 2016 15:55, Frank Millman wrote: > "Steve D'Aprano" wrote in message > news:583653bb$0$1603$c3e8da3$54964...@news.astraweb.com...

async enumeration - possible?

2016-11-29 Thread Frank Millman
r\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 466, in run_until_complete return future.result() TypeError: 'async_generator' object is not iterable Is there any technical reason for this, or is it just that no-one has got around to writing an asyn

Re: async enumeration - possible?

2016-11-29 Thread Frank Millman
"Frank Millman" wrote in message news:o1k355$da5$1...@blaine.gmane.org... Hi all Python 3.6 has introduced Asynchronous Generators, which work very well. [...] However, it does not allow you to enumerate over the generator output - [...] Is there any technical reason for t

Re: async enumeration - possible?

2016-11-30 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87d1hd4d5k@elektro.pacujo.net... One of the more useful ones might be: o = await anext(ait) Definitely! But I found it easy to write my own - async def anext(aiter): return await aiter.__anext__() [...] I don't think bulk iteration in

Re: async enumeration - possible?

2016-11-30 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzid=hrijtv4p1_6frkqub25-o1i8ouquxozd+aujgl7+...@mail.gmail.com... On Wed, Nov 30, 2016 at 1:29 AM, Frank Millman wrote: > > async def anext(aiter): >return await aiter.__anext__() Even simpler: def anext(aiter): return aite

Re: Asyncio -- delayed calculation

2016-12-02 Thread Frank Millman
users, something that I believe would not be possible with threading or multi-processing. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

asyncio question

2016-12-13 Thread Frank Millman
hem. It seems to work. This means that I have a background task running for each concurrent user. Each one will be idle most of the time. My gut-feel says that this will not cause a problem, even if there are hundreds of them, but any comments will be welcome. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio question

2016-12-13 Thread Frank Millman
"Ian Kelly" wrote in message news:CALwzid=vdczAH18mHKaL7ryvDUB=7_y-JVUrTkRZ=gkz66p...@mail.gmail.com... On Tue, Dec 13, 2016 at 6:15 AM, Frank Millman wrote: > The client uses AJAX to send messages to the server. It sends the > message > and continues processing, whil

Re: Recipe request: asyncio "spin off coroutine"

2016-12-14 Thread Frank Millman
7;asyncio.ensure_future(self.close())'. Problem solved. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Recipe request: asyncio "spin off coroutine"

2016-12-14 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87vaulitxe@elektro.pacujo.net... "Frank Millman" : > I changed 'await self.close()', to > 'asyncio.ensure_future(self.close())'. > > Problem solved. A nice insight. However, shouldn'

Re: Recipe request: asyncio "spin off coroutine"

2016-12-15 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87mvfxirba@elektro.pacujo.net... It ain't over till the fat lady sings. Things can accumulate, hang and/or fail in surprising ways. At the very least you should maintain statistics that reveal the number of pending closing tasks for troubleshooting wh

[OT] Security question

2016-12-22 Thread Frank Millman
reply sound reasonable, or are my concerns valid? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Security question

2016-12-22 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmoQK39EU=m3w1zr8xa7myv42kyn4mxprgqmye4rga+...@mail.gmail.com... On Thu, Dec 22, 2016 at 8:39 PM, Frank Millman wrote: > To my surprise, they sent me my existing username *and* my existing > password, all in clear text. > Your co

Re: [OT] Security question

2016-12-22 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmrG+1==nmoxf6cu2pttgcykgz_dvi36gjaqhqa9daf...@mail.gmail.com... On Thu, Dec 22, 2016 at 9:10 PM, Frank Millman wrote: > What about the second part of my query? Is it acceptable that they keep > passwords on their system in clea

Another security question

2016-12-23 Thread Frank Millman
eel that, for my purposes, the above procedure is adequate. Does all this sound reasonable? Any comments appreciated. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Another security question

2016-12-23 Thread Frank Millman
"Steve D'Aprano" wrote in message news:585d009f$0$1599$c3e8da3$54964...@news.astraweb.com... On Fri, 23 Dec 2016 09:19 pm, Frank Millman wrote: > > 3. Generate the password from the string supplied by the user as > follows - > from hashlib import blake

Re: Another security question

2016-12-23 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmpppgm+_ut_amtnb7vgo0vrgptu6iagyjqwvpxg5yp...@mail.gmail.com... On Fri, Dec 23, 2016 at 9:19 PM, Frank Millman wrote: > 3. Generate the password from the string supplied by the user as > follows - >from hashlib import bl

Re: Another security question

2016-12-24 Thread Frank Millman
"Steve D'Aprano" wrote in message news:585d57d5$0$1587$c3e8da3$54964...@news.astraweb.com... There is a stdlib PBKDF2. If you want to avoid third-party dependencies, use that. https://docs.python.org/3.4/library/hashlib.html#hashlib.pbkdf2_hmac Thanks for the pointer. From the docs - 15

Re: Another security question

2016-12-24 Thread Frank Millman
"Frank Millman" wrote in message news:o3lcfk$pah$1...@blaine.gmane.org... By the way, I have realised how I ended up getting sidetracked by Blake2 in the first place. If you call up the online documentation for Python3.6 and select modules>h> hashlib, it takes you stra

Re: working with classes, inheritance, _str_ returns and a list

2017-01-15 Thread Frank Millman
n You have been given an explanation, and a couple of workarounds. Here is another possible workaround, which may help depending on how you actually print the list - If you are saying - for item in list: print(item) you can say instead - for item in list: print(str(item)

Re: working with classes, inheritance, _str_ returns and a list

2017-01-15 Thread Frank Millman
"Frank Millman" wrote in message news:o5hlh4$1sb$1...@blaine.gmane.org... If you are saying - for item in list: print(item) you can say instead - for item in list: print(str(item)) This is not correct, sorry. print(item) will automatically print

Re: working with classes, inheritance, _str_ returns and a list

2017-01-15 Thread Frank Millman
"Frank Millman" wrote in message news:o5hnbq$q36$1...@blaine.gmane.org... "Frank Millman" wrote in message news:o5hlh4$1sb$1...@blaine.gmane.org... > > If you are saying - > for item in list: > print(item) > > you can say instead - > f

Re: Which part of the loop is it going through in this class frame?

2018-03-07 Thread Frank Millman
he variable 'self.time'. 'time', a local variable, is set to '6:30'. 'self.time', an instance variable, is set to '5:30'. You printed self.time, hence the result. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: String Formatting with new .format()

2018-03-28 Thread Frank Millman
assign its numerical position to all the elements in the template that use that value. They will all be populated with the same value. Personally, I always use empty {} unless point 2 above applies. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Question about Decimal and rounding

2018-04-27 Thread Frank Millman
ng aloud, maybe this is a better test - is_integer = (value == value.quantize(0)) Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about Decimal and rounding

2018-04-27 Thread Frank Millman
"Thomas Jollans" wrote in message news:19223891-2006-d496-bdfe-32776834e...@tjol.eu... On 27/04/18 10:21, Frank Millman wrote: > I have an object which represents a Decimal type. > > It can receive input from various sources. It has to round the value to > a particul

Problem with OrderedDict

2018-05-30 Thread Frank Millman
difference is not caused by using a normal dictionary. I am using Python 3.6.0. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem with OrderedDict

2018-05-30 Thread Frank Millman
"Steven D'Aprano" wrote in message news:pem8b8$lm6$4...@blaine.gmane.org... On Wed, 30 May 2018 10:48:06 +0200, Frank Millman wrote: > I tried to reduce it to a simple example. I succeeded, but there are two > problems - > > 1. It always fails, so I have not reprodu

Re: Problem with OrderedDict - progress report

2018-05-31 Thread Frank Millman
"Frank Millman" wrote in message news:pemchs$r12$1...@blaine.gmane.org... So working backwards, I have solved the first problem. I am no nearer to figuring out why it fails intermittently in my live program. The message from INADA Naoki suggests that it could be inherent in CPython

Re: Problem with OrderedDict - progress report

2018-05-31 Thread Frank Millman
"Steven D'Aprano" wrote in message news:peorib$1f4$2...@blaine.gmane.org... On Thu, 31 May 2018 10:05:43 +0200, Frank Millman wrote: > From the interpreter session below, you will see that adding a key while > processing the *last* key in an OrderedDict does not give r

Re: Problem with OrderedDict - progress report

2018-06-01 Thread Frank Millman
"Gregory Ewing" wrote in message news:fnccd8ff3s...@mid.individual.net... Chris Angelico wrote: > It is an error to mutate the dictionary *and then continue to iterate > over it*. But if you're processing the last key, and you add one so that it's no longer the last key, what should happen?

Re: list of lists

2018-07-22 Thread Frank Millman
econd element of the first inner list. HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: coding style - where to declare variables

2018-07-23 Thread Frank Millman
at Python objects have 3 attributes - a type, a value, and a unique id. One thing that they do *not* have is a name. Once I understood that, a lot of things became clearer. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Pylint false positives

2018-08-14 Thread Frank Millman
quite a few of them, so it would add some clutter. Second question - if my present code is not unpythonic, is there an easy way to suppress the error messages, without disabling 'no-member' altogether? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-14 Thread Frank Millman
"D'Arcy Cain" wrote in message news:865ed61a-cf1d-959f-f77e-dc586fe6e...@vybenetworks.com... On 2018-08-14 03:38 AM, Frank Millman wrote: > Hi all > > Pylint is flagging a lot of lines as errors that I would consider to be > acceptable. > > I have an abstr

Re: Pylint false positives

2018-08-14 Thread Frank Millman
"Thomas Jollans" wrote in message news:53faf0ef-4054-53fa-6179-a862495ea...@tjol.eu... On 2018-08-14 09:38, Frank Millman wrote: > Hi all > > Pylint is flagging a lot of lines as errors that I would consider to be > acceptable. > > I have an abstract class ClassA w

Re: Pylint false positives

2018-08-14 Thread Frank Millman
"Frank Millman" wrote in message news:pku0qd$ua5$1...@blaine.gmane.org... Pylint is flagging a lot of lines as errors that I would consider to be acceptable. I have an abstract class ClassA with a number of concrete sub-classes. ClassA has a method which invokes 'self.metho

Re: Pylint false positives

2018-08-16 Thread Frank Millman
"D'Arcy Cain" wrote in message news:6b4b8587-46c0-19b0-c538-efdf396f0...@vybenetworks.com... On 2018-08-14 04:58 AM, Frank Millman wrote: > As an example, I have a master class defining a unit of data (i.e. the > value of a column) retrieved from a database. I have separ

Re: Pylint false positives

2018-08-17 Thread Frank Millman
"Steven D'Aprano" wrote in message news:pl5qbk$r7k$5...@blaine.gmane.org... On Fri, 17 Aug 2018 08:14:02 +0200, Frank Millman wrote: > I find that using a separate method per subclass does exactly what I > want, and that part of my project has been working stably for

Re: Pylint false positives

2018-08-17 Thread Frank Millman
"Dan Sommers" wrote in message news:pl622a$a1f$1...@blaine.gmane.org... On Fri, 17 Aug 2018 09:46:01 +0200, Frank Millman wrote: > It is just a slight annoyance (to me) that pylint complains about the > subclass methods when they are called from the Field class. I don't

Question about floating point

2018-08-28 Thread Frank Millman
' at this point? Or if I do this - z = (1.1 + 2.2) * 10 / 10 z 3.3 What makes it different from the first example? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about floating point

2018-08-28 Thread Frank Millman
"Frank Millman" wrote in message news:pm3l2m$kv4$1...@blaine.gmane.org... I know about this gotcha - >>> x = 1.1 + 2.2 >>> x 3.3003 [...] >>> y = 3.3 >>> y 3.3 [...] >>> z = (1.1 + 2.2) * 10 / 10 >>>

Re: Question about floating point

2018-09-01 Thread Frank Millman
"Frank Millman" wrote in message news:... "Frank Millman" wrote in message news:pm3l2m$kv4$1...@blaine.gmane.org... I know about this gotcha - >>> x = 1.1 + 2.2 >>> x 3.3003 [...] I have enjoyed the discussion, and I have learnt a lot abo

Quickest way to concatenate strings

2018-10-11 Thread Frank Millman
c per loop Interestingly, the 'format' function is slower - C:\Users\User>python -m timeit -s "x='a'*500; y='b'*500; z='c'*500" '{}{}{}'.format(x, y, z) 50 loops, best of 5: 559 nsec per loop I am using Python 3.7.0 on Windows 10. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Quickest way to concatenate strings

2018-10-12 Thread Frank Millman
On 12/10/2018 08:36, Thomas Jollans wrote: > On 12/10/2018 07:55, Frank Millman wrote: > Hi all > > > I have often read that the quickest way to concatenate a number of > > strings is to place them in a list and 'join' them - > > > > > > C

Re: Quickest way to concatenate strings

2018-10-12 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:cnk0sdl5a7p17framc5er811p1230mp...@4ax.com... On Fri, 12 Oct 2018 07:55:58 +0200, "Frank Millman" declaimed the following: >I have often read that the quickest way to concatenate a number of >strings >is to place t

<    1   2   3   4   5   6   7   8   >