Re: Entering a very large number

2018-03-26 Thread Richard Damon
On 3/26/18 8:46 AM, bartc wrote: On 26/03/2018 13:30, Richard Damon wrote: On 3/26/18 6:31 AM, bartc wrote: The purpose was to establish how such int("...") conversions compare in overheads with actual arithmetic with the resulting numbers. Of course if this was done in C with

Re: Entering a very large number

2018-03-30 Thread Richard Damon
On 3/30/18 6:41 AM, bartc wrote: On 27/03/2018 04:49, Richard Damon wrote: On 3/26/18 8:46 AM, bartc wrote: Hence my testing with CPython 3.6, rather than on something like PyPy which can give results that are meaningless. Because, for example, real code doesn't repeatedly execute the

Re: Asynchronous processing is more efficient -- surely not?

2018-04-04 Thread Richard Damon
sing can better use up, so even processor usage can be improved in many cases. In most cases I am familiar with, the type of asynchronous programming you are talking about is to move I/O bound operations into a second execution path, allowing your main path to focus on keeping the CPU busy. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: object types, mutable or not?

2018-05-13 Thread Richard Damon
inting to (the string 'a1b2') and then obj was set to point to that new object, and the old string object became unreferenced and will at some point be cleaned up (if between the two assignment you did a obj2 = obj, then obj2 would continue to point to that original string object).

Re: syntax oddities

2018-05-18 Thread Richard Damon
needed'. Here Interspersed/Bottom posting works better (Interspersed if responding point by point, Bottom if single point or responding to the message en-total.) Mailing list, Usenet, Forums and the like all tend to fall into the second category, but people more used to the more private typ

Re: syntax oddities

2018-05-18 Thread Richard Damon
On 5/18/18 10:38 AM, Chris Angelico wrote: > On Sat, May 19, 2018 at 12:30 AM, Richard Damon > wrote: >> I would divide the two communities/cultures differently. Top Posting is >> reasonable, effective and common in an environment where the primary >> recipients of the m

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-20 Thread Richard Damon
euristics in the file and try to guess. Another option is to open the file in a text editor which will be more forgiving and show the bad character as an error symbol, and see if  you can recognize what 'language' (human) the user seems to have been using, and guess the character encoding from that (or just remove the bad characters if they are just in comments/unimportant strings.) -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: what does := means simply?

2018-05-20 Thread Richard Damon
strange ((or random) combinations for generation choices to come up with files to stress test other implementations, and be totally picky about the input format, reporting the slightest deviation from the spec. The second option is the best to choose if you really want to make your application as useful as possible (except as a stress test). -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Some Issues on Tagging Text

2018-05-25 Thread Richard Damon
did not want. > For example, > if my target phrases included terms like, > government of Mexico, > > now in my list I would have words with their tags as, > government > of > Mexico > > If I put these words in list it would tag > government/TAG of/TAG Mexico > > but would also tag all the "of" which may be > anywhere like haze is made of/TAG dense white, > clouds of/TAG steam, etc. > > Cleaning these unwanted places become a daunting task > to me. > > I have been experimenting around > wordlist=["Kilauea volcano","Kilauea/TAG > volcano/TAG"),("Hawaii","Hawaii/TAG"),...] > tag=reduce(lambda a, kv: a.replace(*kv), wordlist, corpus) > > is giving me sizeably good result but size of the wordlist is slight concern. > The issue then sounds like you implemented tagging based on words, but what you REALLY want is tagging based on phrases. It looks like you did this in part because you had a tool that gave you words and not phrases. The key here is to reframe the solution into the terms the problem states or transforms the problem statement into something based on the terms of the tools you are using. Basically you had a plank of wood to attach to something and a screw, and saw a hammer, so you hammered the screw in and wondered why it didn't work that well. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Some Issues on Tagging Text

2018-05-27 Thread Richard Damon
I got good results in re earlier but I would surely check your point. > > Thank you again for your kind time and a nice discussion. > I will point out that I still haven't heard a statement of what you actually are trying to do. The first step of designing an Expert System (a computer system designed to do something that people can do) is come up with a clear goal of what is to be done that makes no reference to 'computers'. This later part is important as you really want to go to the final users and think about their needs. To frame things in computer terms means that you have made the computers and their methods more important that the final users. The second step is asking the experts who do this themselves how they do it (they might be using computers to do some of this, but you want to get the details of the 'wetware' processing involved, not computer algorithms). Only after you get a good description in human terms of what and how do you turn to thinking about how to implement on a computer. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: List replication operator

2018-05-27 Thread Richard Damon
> For the right price, at least. > Not quite, .invalid has been promised (I beleive) to NEVER be a valid TLD Also, I think two letter TLDs are reserved for country codes, and not up for sale (except by getting ISO to assign you a country code). -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why exception from os.path.exists()?

2018-06-01 Thread Richard Damon
file that can never exists and bypass the system call are return false. 3) we can process os.path.exists('foo\0bar') by just passing the string to the system call, making it the same as os.path.exists('foo') The last is probably the one that we can say is likely wrong, but argume

Re: Why exception from os.path.exists()?

2018-06-01 Thread Richard Damon
On 6/1/18 9:58 AM, Chris Angelico wrote: > On Fri, Jun 1, 2018 at 11:41 PM, Richard Damon > wrote: >> The confusion is that in python, a string with an embedded null is >> something pretty much like a string without an embedded null, so the >> programmer might not think

Re: Sorting NaNs

2018-06-02 Thread Richard Damon
s could be called 'predictable' but that is a real stretch. Because the sort is stable, I would expect that away from the Nans in the output the results are likely to be at least mostly sorted, as the algorithm should mostly be working right except where a NaN is moving through. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why exception from os.path.exists()?

2018-06-02 Thread Richard Damon
n't just that it is possible, Microsoft provides that layer, it just isn't the normal API they suggest using and needs to be explicitly enabled. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Sorting NaNs

2018-06-02 Thread Richard Damon
s' are false, and 'not equals' are true. Thus all NaNs are unequal to all numbers, including themselves, but are neither greater than or than than any of them. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Sorting NaNs

2018-06-02 Thread Richard Damon
om the input set and process what is left. If nothing, then return a NaN (treating NaN as a 'No Data' placeholder). These are very different in interpretation, and not hard to create as a wrapper to the function, so maybe not worth adding to the core function and make it a bit slower. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Attachments (was: How can an int be '+' with a tuple?)

2018-06-04 Thread Richard Damon
whole message if it has an attachment) if posted to a group not specifically marked as a 'binary' newsgroup, just like a lot of mailing list are similarly setup. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why exception from os.path.exists()?

2018-06-07 Thread Richard Damon
filenames in the API, and we need a back door to allow us to define what encoding to use for filenames (and be able to detect that it doesn't work for a given file, and change it on the fly to try again), or we need an alternate API that lets us pass raw bytes as file names and the program needs to know how to handle the raw filename for that particular file system. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Valid encodings for a Python source file

2018-06-08 Thread Richard Damon
x27;Byte Order Problem', but doesn't allow the UTF-16 (0xFF, 0xFE or 0xFE, 0xFF) or UCS-4 BOM (0x00, 0x00, 0xFE, 0xFF or 0xFF, 0xFE, 0x00, 0x00)  marks which while the formats are unlikely are very likely to have the marks, and detecting the marks are very important to detect those encoding as

Re: Stefan's headers [was:Names and identifiers]

2018-06-09 Thread Richard Damon
u would see much more use of the hobbling copy protection technologies, and automatically enforced licensing methods. That, and a lot less software produced. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Stefan's headers [was:Names and identifiers]

2018-06-09 Thread Richard Damon
On 6/9/18 6:48 AM, Marko Rauhamaa wrote: > Richard Damon : >> Copyright law is not what makes something 'closed source' in the eyes >> of the Open Source community. For example, Microsoft doesn't use >> Copyright to keep the source code for Windows secret, they

Re: FULLSCREEN and DOUBLEBUF

2018-06-09 Thread Richard Damon
with > >     screen = pygame.display.set_mode((720,480), pygame.FULLSCREEN | > pygame.DOUBLEBUF) > > AND > > What does -2147483648 tell me? Does this number need converting? That number is printed in Decimal, the listing gives it in hex. If you convert the number to hex you get 0x8000 -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Stefan's headers [was:Names and identifiers]

2018-06-09 Thread Richard Damon
On 6/9/18 3:06 PM, Marko Rauhamaa wrote: > Richard Damon : > >> On 6/9/18 6:48 AM, Marko Rauhamaa wrote: >>> It would leak out with developers who move to new jobs. And that would >>> be good. >> >> If you plan on eliminating not only copyright, but tra

Re: Sorting NaNs

2018-06-10 Thread Richard Damon
On 6/10/18 3:28 PM, Anders Munch wrote: > Richard Damon wrote: > >> The two behaviors that I have heard suggested are: >> >> 1) If any of the inputs are a NaN, the median should be a NaN. >> (Propagating the NaN as indicator of a numeric error) >> >>

Re: Python list vs google group

2018-06-15 Thread Richard Damon
hardware is marginal (but the Linux driver didn't push the unit to full speed and got around the issue), of if the Windows driver broke some specification but still sort of worked, especially if things were warm, while the Linux driver did it right. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Python list vs google group

2018-06-16 Thread Richard Damon
On 6/15/18 11:07 PM, Jim Lee wrote: > > > On 06/15/2018 07:08 PM, Richard Damon wrote: >> On 6/15/18 9:00 PM, Jim Lee wrote: >>> >>> On 06/15/2018 05:00 PM, Chris Angelico wrote: >>>> On Sat, Jun 16, 2018 at 4:52 AM, Rob Gaddi >>>>

Re: Feeding the trolls

2018-06-22 Thread Richard Damon
ms tend not to support this type of filter. It was important for Usenet as it is (or at least was) a much higher volume of information (and noise) system, so it was quite common to pull down only a subset of a group. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: translating foreign data

2018-06-22 Thread Richard Damon
define what decimal separator to use (or what locale to use). You can get the decimal separator issue even on files that are pure ASCII, and Latin-1 is full of the issue too. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: translating foreign data

2018-06-23 Thread Richard Damon
y came from. They're now > full-fledged Unicode characters, and Python's float() and int() functions > can easily deal with non-ASCII digits. So long as he has digits in the > first place, float() and int() will deal with them correctly. > > -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 7:46 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > >> If you know the Locale, then you do know what the decimal separator is, >> as that is part of what a locale defines. > A locale defines a set of common cultur

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 8:03 AM, Marko Rauhamaa wrote: > Richard Damon : >> If you know the Locale, then you do know what the decimal separator >> is, as that is part of what a locale defines. > I don't know what that sentence means. When you set the locale > >> The issue is th

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 8:28 AM, Peter J. Holzer wrote: > On 2018-06-23 08:12:52 -0400, Richard Damon wrote: >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >>>> If you know the Locale, then you do know what the de

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > Richard Damon : > >> On 6/23/18 8:03 AM, Marko Rauhamaa wrote: >>> I always know my locale. The locale is tied to the human user. >> No, it should be tied to the data you are processing. >In computing, a locale is a set

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 10:05 AM, Peter J. Holzer wrote: > On 2018-06-23 08:41:38 -0400, Richard Damon wrote: >> On 6/23/18 8:28 AM, Peter J. Holzer wrote: >>> On 2018-06-23 08:12:52 -0400, Richard Damon wrote: >>>> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>>&g

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 11:44 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 08:12:52 -0400, Richard Damon wrote: > >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >>> >>>> If you know the Locale,

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 11:27 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: > >> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >>> Ok. Here's a value for you: >>> >>> 100€ >>> >>> I see '1', &

Re: translating foreign data

2018-06-23 Thread Richard Damon
On 6/23/18 5:31 PM, Ben Finney wrote: > Richard Damon writes: > >> On 6/23/18 11:27 AM, Steven D'Aprano wrote: >>>> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >>>>> Richard Damon wrote: >>>>>> Data presented to the user should nor

Re: syntax difference

2018-06-24 Thread Richard Damon
heir bash scripts in your > language, and complaining bitterly about how your language sucks because > it isn't bash. > >From what I have seen from Bart in other groups, Bart want to write in 'Bart' using existing languages and is frustrated that no one (but him) has written a language exactly to his specs. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: translating foreign data

2018-06-24 Thread Richard Damon
On 6/23/18 10:44 PM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 17:52:55 -0400, Richard Damon wrote: > >> If you have more than just a number representing a value in the locale >> currency, you can't ask the locale how to present/accept it. > You're the only

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/22/18 11:21 PM, Steven D'Aprano wrote: > On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > >> Steven D'Aprano writes: >> >>> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >>> >>>>>> The

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 8:28 AM, Peter J. Holzer wrote: > On 2018-06-23 08:12:52 -0400, Richard Damon wrote: >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >>>> If you know the Locale, then you

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 7:46 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: > >> If you know the Locale, then you do know what the decimal separator is, >> as that is part of what a locale defines. > A locale define

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 9:05 AM, Marko Rauhamaa wrote: > Richard Damon : > >> On 6/23/18 8:03 AM, Marko Rauhamaa wrote: >>> I always know my locale. The locale is tied to the human user. >> No, it should be tied to the data you are processing. >In c

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 8:03 AM, Marko Rauhamaa wrote: > Richard Damon : >> If you know the Locale, then you do know what the decimal separator >> is, as that is part of what a locale defines. > I don't know what that sentence means. When you set the locale > &

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 10:05 AM, Peter J. Holzer wrote: > On 2018-06-23 08:41:38 -0400, Richard Damon wrote: >> On 6/23/18 8:28 AM, Peter J. Holzer wrote: >>> On 2018-06-23 08:12:52 -0400, Richard Damon wrote: >>>> On 6/23/18 7:46 AM, Steven D'Apra

Re: translating foreign data

2018-06-24 Thread Richard Damon
From: Richard Damon On 6/23/18 11:44 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 08:12:52 -0400, Richard Damon wrote: > >> On 6/23/18 7:46 AM, Steven D'Aprano wrote: >>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote: >>> >>>&g

Re: translating foreign data

2018-06-25 Thread Richard Damon
From: Richard Damon On 6/23/18 11:27 AM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 09:42:29 -0400, Richard Damon wrote: > >> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >>> Ok. Here's a value for you: >>> >>> 100ΓΘ¼ >>> >

Re: translating foreign data

2018-06-25 Thread Richard Damon
From: Richard Damon On 6/23/18 5:31 PM, Ben Finney wrote: > Richard Damon writes: > >> On 6/23/18 11:27 AM, Steven D'Aprano wrote: >>>> On 6/23/18 9:05 AM, Marko Rauhamaa wrote: >>>>> Richard Damon wrote: >>>>>> Data presented to

Re: I'm getting a spamassassin party here

2018-06-26 Thread Richard Damon
s, From is mangled, but the original added to the body, References are removed (so they don't thread), a day or two old. It looks like it was relayed to the list by news.bbs.nz -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: syntax difference

2018-06-26 Thread Richard Damon
From: Richard Damon On 6/24/18 3:02 PM, Steven D'Aprano wrote: > On Sun, 24 Jun 2018 19:37:33 +0100, Bart wrote: > >> I want to program in /my/ style > Python is not Java, and Java is not Python either. Nor is it "Bart's > Language", or C, or Forth, or Lis

Re: translating foreign data

2018-06-26 Thread Richard Damon
From: Richard Damon On 6/23/18 10:44 PM, Steven D'Aprano wrote: > On Sat, 23 Jun 2018 17:52:55 -0400, Richard Damon wrote: > >> If you have more than just a number representing a value in the locale >> currency, you can't ask the locale how to present/accept it. >

Re: translating foreign data

2018-06-26 Thread Richard Damon
From: "Richard Damon" From: Richard Damon On 6/22/18 11:21 PM, Steven D'Aprano wrote: > On Fri, 22 Jun 2018 20:06:35 +0100, Ben Bacarisse wrote: > >> Steven D'Aprano writes: >> >>> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote: >>

Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Richard Damon
as a literal as it causes a number of these issues. Yes, it allows you to not need to double it in many cases but that just sets you up for the mistakes that started the thread. It is probably too late to change that behavior now though. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread Richard Damon
On 7/2/18 9:20 AM, Mikhail V wrote: > [Richard Damon] > >> The one major issue with backslashes is that they are a special >> character in string literals, so you either need to use raw literals a >> remember the few cases they still act as special characters, or rememb

Re: Getting posts to sort chronologically in tree view

2018-07-03 Thread Richard Damon
; have that explicitly enabled in my subscription settings. > > -Jim > Jim, That's a 'feature' of gmail, it automatically suppresses duplicate copies of messages (even if not identical) and considers the version back from the list to be a duplicate of the one you sent. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading EmailMessage from file

2018-07-15 Thread Richard Damon
A raw email message should be treated as a ‘bag of bytes’, and in processing it, the encoding of the various sections determined by headers in the message (or taking defined defaults if not specified). I suspect that means that you should read as a binary file. I would hope that the module has t

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-16 Thread Richard Damon
> On Jul 16, 2018, at 12:51 PM, Steven D'Aprano > wrote: > >> On Mon, 16 Jul 2018 00:28:39 +0300, Marko Rauhamaa wrote: >> >> if your new system used Python3's UTF-32 strings as a foundation, that >> would be an equally naïve misstep. You'd need to reach a notch higher >> and use glyphs or othe

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-16 Thread Richard Damon
> On Jul 16, 2018, at 1:36 PM, Steven D'Aprano > wrote: > > On Mon, 16 Jul 2018 13:11:23 -0400, Richard Damon wrote: > >>> On Jul 16, 2018, at 12:51 PM, Steven D'Aprano >>> wrote: >>> >>>> On Mon, 16 Jul 2018 00:28:39 +0300, Ma

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-16 Thread Richard Damon
> On Jul 16, 2018, at 3:28 PM, Terry Reedy wrote: > >> On 7/16/2018 1:11 PM, Richard Damon wrote: >> >> Many consider that UTF-32 is a variable-width encoding because of the >> combining characters. It can take multiple ‘codepoints’ to define what >>

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-16 Thread Richard Damon
> On Jul 16, 2018, at 9:21 PM, Steven D'Aprano > wrote: > >> On Mon, 16 Jul 2018 19:02:36 -0400, Richard Damon wrote: >> >> You are defining a variable/fixed width codepoint set. Many others want >> to deal with CHARACTER sets. > > Good luck com

Re: Glyphs and graphemes [was Re: Cult-like behaviour]

2018-07-17 Thread Richard Damon
> On Jul 17, 2018, at 3:44 AM, Steven D'Aprano > wrote: > > On Mon, 16 Jul 2018 21:48:42 -0400, Richard Damon wrote: > >>> On Jul 16, 2018, at 9:21 PM, Steven D'Aprano >>> wrote: >>> >>>> On Mon, 16 Jul 2018 19:02:36 -0400, R

Re: coding style - where to declare variables

2018-07-22 Thread Richard Damon
> On Jul 22, 2018, at 8:48 AM, Sharan Basappa wrote: > > In other programming languages (e.g. C, C++), as a good practice, variables > are declared right at the start of the program, irrespective of where it is > normally used. What is the practice in Python? > > I see that, most of the code

Re: coding style - where to declare variables

2018-07-22 Thread Richard Damon
> On Jul 22, 2018, at 3:50 PM, Marko Rauhamaa wrote: > I wish people stopped talking about "name binding" and "rebinding," > which are simply posh synonyms for variable assignment. Properly, the > term "binding" comes from lambda calculus, whose semantics is defined > using "bound" and "free" var

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Richard Damon
ence to strings/bytes or the warning is wrong. Using the excuse > that normal comparison is being used seems a bit feeble. It would > clearly improve speed if object identity were to be used, but I > suppose that's not the case for other reasons. One problem with using identity for strin

Re: Partitioning a list

2018-08-22 Thread Richard Damon
> On Aug 22, 2018, at 8:51 AM, Paul Moore wrote: > >> On Wed, 22 Aug 2018 at 00:44, Poul Riis wrote: >> >> I would like to list all possible ways to put N students in groups of k >> students (suppose that k divides N) with the restriction that no two >> students should ever meet each other i

Re: Generating a specific list of intsgers

2018-08-25 Thread Richard Damon
he k values and test each result for being prime, except that will never return 0 to say no such k exists. That will require some higher level of math to detect (or an arbitrary cap on k, and we say we can say 0 if the only k is too big, but with big nums, that would be VERY large and take a very long time. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 12:48 PM, Dennis Lee Bieber wrote: >> The sequence is defined by: >> >> For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = a(n) >> + a(n-2). >> > Confusing explanation -- do you really mean that for n>=4 you are > returning TWO values? If so, it is not a stric

Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 1:58 PM, Musatov wrote: > On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote: >> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote: >>>> The sequence is defined by: >>>> >>>> For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a

Re: Generating a specific list of intsgers

2018-08-26 Thread Richard Damon
ould compute an upper limit for k given n, then we could do the computation, but we need to have some rule to stop, or there may be some values of n that we will loop forever on. As has been said, this problem is still in the domain of needing some math to give us the rule to compute wi

Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
e reason I presented what I say as the 'normalized' equations which are what would be more needed to actually compute as a function. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Observations on the List - "Be More Kind"

2018-10-09 Thread Richard Damon
On 10/9/18 12:10 AM, jf...@ms4.hinet.net wrote: > I am wondering the role of the moderator. > > Does he own the server or pay the bill? Where he get the power to suspending > people? Is he a police or judge? Can he shoot someone just because he has any > reason? > > What will happen if his powe

Re: Observations on the List - "Be More Kind"

2018-10-09 Thread Richard Damon
On 10/9/18 2:03 PM, Chris Angelico wrote: > On Wed, Oct 10, 2018 at 4:57 AM Richard Damon > wrote: >> Shoot, as in physically, generally no such right; metaphorically, as in >> sever discipline in list operations, generally yes, though perhaps >> limited from some gro

Re: how to match list members in py3.x

2018-11-25 Thread Richard Damon
print('new: ',newlist) The first thing I note in looking at this is that the second loop will run AFTER the first loop completes, not for each step of the loop, because you outdented the code. Also, you unconditionally add the word, and THEN check if it is in the list. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Python2.7 unicode conundrum

2018-11-25 Thread Richard Damon
t; (u'\xe4',) > dh@jenna:~/python$ > > > Why do you say it has been convert to 'Latin'. The string prints as being Unicode. Internally Python doesn't store strings as UTF-8, but as plain Unicode (UCS-2 or UCS-4 as needed), and code-point E4 is the character you want. The encoding statement tells python how your source file is encoded. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why Python don't accept 03 as a number?

2018-12-08 Thread Richard Damon
eading zeros either. As other have said, the work to compute the value yourself rather than due the text substitution and eval is close to comparable. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why Python don't accept 03 as a number?

2018-12-08 Thread Richard Damon
On 12/8/18 12:40 PM, Avi Gross wrote: > You are solving for: ab + aa + cd == ce Actually, an even quicker analysis for this particular problem is: from the 10s digits, a + a + c + carryin = c Thus a and carryin must both be 0 (carryin can not be negative, nor any of the variables) thus the final

Re: Why Python don't accept 03 as a number?

2018-12-08 Thread Richard Damon
uld also handle other related problems like SEND+MORE=MONEY But now, the input equation isn't controlled by the program, so you need to be very careful about using it for something that gets sent to eval, and by the time you take that care, perhaps it is easier to do the safer way. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Rate limiting a web crawler

2018-12-26 Thread Richard Damon
elp in replies would be an indication of scale. Is you application crawling just a few sites, so that you need to pause between accesses to keep the hit rate down, or are you calling a number of sites, so that if you are going to delay crawling a page from one site, you can go off and crawl anothe

Re: Problem in Installing version 3.7.2(64 bit)

2019-01-30 Thread Richard Damon
HTML formatted, so rejecting rather than just stripping these would make a lot of people unhappy/confused. A lot of people also have little graphic included in their base message as signatures, etc, that naturally get stripped out in the conversion to plain text. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Prepare accented characters for HTML

2019-03-28 Thread Richard Damon
> On Mar 28, 2019, at 7:53 AM, Tony van der Hoff wrote: > Thanks, Chris. The problem is not with the browser, but Jinja crashes. > Probably a bug, but I'm too wedded to that engine to change now. I'll > raise it on the Jinja bug site. > Using Google, it says that Jinja2 is Unicode capable, if

Re: Conway's game of Life, just because.

2019-05-07 Thread Richard Damon
in the rules at the edge, so any pattern that reaches the edge no longer has a valid result. The torus effect still perturbs the result, but that perturbation is effectively that the universe was tiled with an infinite grid of the starting pattern, so represents a possible universe. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Conway's game of Life, just because.

2019-05-08 Thread Richard Damon
On 5/8/19 4:26 AM, Paul Moore wrote: > On Wed, 8 May 2019 at 03:39, Richard Damon wrote: >> My experience is that the wrap around is common, as otherwise the hard >> edge causes a discontinuity in the rules at the edge, so any pattern >> that reaches the edge no longer ha

Re: Help? How do i solve this problem with Python List Concept

2019-05-11 Thread Richard Damon
On 5/11/19 5:02 PM, Ben Bacarisse wrote: > Donald Tripdarlinq writes: > >> In the traditional Yoruba tribal Set-Up in Nigeria,West Africa the >> tradition of inheritance is very important. Now, The relative position >> of a child in the family counts when the issue of inheritance is >> considered

Re: Handle foreign character web input

2019-06-29 Thread Richard Damon
nerated codes). All the various 'codepages' were useful in their day, when machines were less capable, and Unicode hadn't been invented or wasn't supported well or was too expensive to use. Now (as I understand it), all Python (3) 'Strings' are internally Unicode, if yo

Re: Handle foreign character web input

2019-06-30 Thread Richard Damon
On 6/30/19 4:00 AM, moi wrote: > Le samedi 29 juin 2019 19:25:40 UTC+2, Richard Damon a écrit : >> >> Now (as I understand it), all Python (3) 'Strings' are internally >> Unicode, if you need something with a different encoding it needs to be >> in Bytes. >&

Re: Handle foreign character web input

2019-06-30 Thread Richard Damon
On 6/30/19 10:04 AM, Chris Angelico wrote: > On Sun, Jun 30, 2019 at 10:26 PM Richard Damon > wrote: >> On 6/30/19 4:00 AM, moi wrote: >> > I didn't see who you were quoting, but it looks like our old "Py3's > Unicode is buggy" troll is back (or maybe

Re: How to sort the files based on the date?

2019-07-15 Thread Richard Damon
ble, as it relies on changing the file name format would be to switch the file names to using something like an ISO date format fo the name, ISO dates are in the format -MM-DD (Month is a two digit number) which has the nice attribute that the alphabetical sort is also a date sort. If you can

Re: join and split with empty delimiter

2019-07-18 Thread Richard Damon
e significant, that unless the join list was built of exactly 1 character strings, the split won't match, and that seems somewhat special case for a variable delimiter. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why am I getting duplicate values in my output?

2019-07-26 Thread Richard Damon
atter on, the list is still refering to that now changed dictionary. Either you need to copy the dictionary, and add the new copy, or create a new copy with each iteration of the loop. At the end of the loop, ap_list is a list of all the same dictionary, the same one that ap_dict is bound to, you just kept changing it every time through the loop. if ap_dict was set to a new empty dictionary in the loop, then all the copies would be distinct. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Definite or indefinite article for non-singletons?

2019-07-28 Thread Richard Damon
licated history), can be filled with all sorts of strangeness, and this can get compounded when it wants to be harmonized with a technical subject which can't deal with some of the naturalness of language, thus we can't try to use some sort of rule matching the type of article to the appropriateness of the python word "is". -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Definite or indefinite article for non-singletons?

2019-07-28 Thread Richard Damon
doesn't call for the preposition. Saying "All of the things" to mean every single one of them implies creating some category that just happens to include every one of them. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Boolean comparison & PEP8

2019-07-28 Thread Richard Damon
ess it all depends on what you need to do. If you just need to > check truthiness, just do "if greeting" If you need to know if the > variable is some particular sentinel, use the "if greeting is whatever". I thought the recommended value was None, not False (so you don't

Re: Boolean comparison & PEP8

2019-07-28 Thread Richard Damon
On 7/28/19 8:25 PM, Chris Angelico wrote: > On Mon, Jul 29, 2019 at 10:15 AM Richard Damon > wrote: >> On 7/28/19 7:46 PM, Michael Torrie wrote: >>> On 7/28/19 5:55 AM, Jonathan Moules wrote: >>>> But this appears to be explicitly called out as being "Wo

Re: Boolean comparison & PEP8

2019-07-28 Thread Richard Damon
On 7/28/19 8:46 PM, Chris Angelico wrote: > On Mon, Jul 29, 2019 at 10:43 AM Richard Damon > wrote: >> On 7/28/19 8:25 PM, Chris Angelico wrote: >>> Of course, if the third value can be simplified away (eg None means >>> "use the global default"), th

Re: Why they use this: duration = time.time() - self.start_time + 1

2019-08-04 Thread Richard Damon
d the 0 duration, and after a human scale duration, doesn't perturb the value enough to make much of a difference. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: absolute path to a file

2019-08-17 Thread Richard Damon
on??? I don't think it has its own Python, but it sounds like it sort of extends the file system, and uses a leading // for something special. That means files that begin with // need to be processes through the blender library and not be used directly to the OS. -- Richard Damon --

Re: absolute path to a file

2019-08-20 Thread Richard Damon
ately that is likely fine, and I've misread the event (provided > gmane backfeeds to the mailing list). I think gmane feed the newsgroup comp.lang.python which feeds python-list@python.org. Python-list probably then sees that you already were getting a direct copy so omits sending you

Re: How should we use global variables correctly?

2019-08-22 Thread Richard Damon
he C/C++ file scoped 'static' which is less bad that fully global variables (the extern variable). -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: How to create a list and append to list inside a mqtt and GUI program?

2019-09-01 Thread Richard Damon
GUI.py to test this and test1.py and > test2.py are the files which can be used to import GUI . To make the list persistent you need to create it as a module global or as a class member of a persistent object (like your MainWindow) -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   >