Re: pathlib

2019-10-03 Thread Richard Damon
he right term here, but the beginning of the documentation for Pathlib does sort of define what it means here: Path classes are divided between pure paths <https://docs.python.org/3/library/pathlib.html#pure-paths>, which provide purely computational operations without I/O, and concrete paths <https://docs.python.org/3/library/pathlib.html#concrete-paths>, which inherit from pure paths but also provide I/O operations. So for Pathlib, Concrete means that it provides access to I/O operations and thus can only handle paths of the flavor of the OS the program is running on. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: python3, regular expression and bytes text

2019-10-12 Thread Richard Damon
UCS-4) at input (if needed) and process in that domain. You do need to be prepared to run into files which are encoded in some locally defined 8-bit code page. In Python3,  strings are unicode encoded, and you don't need to worry about the details of which encoding is used internally, Python will deal with that itself. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-18 Thread Richard Damon
on format for floating point). Scientific notation vs fixed point notation is purely an OUTPUT configuration, not a function on how the number is stored (so in one sense IS more closely linked to a string than the float itself). -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-18 Thread Richard Damon
print(x) >> 4.449e-05 >> >> hth >> Gys > Hello, > > I don't only need a human readable representation of number, I need to use it > further, do things such as putting it in a pandas object and saving it to an > excel file. > > Doing thi

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-18 Thread Richard Damon
On 10/18/19 9:03 AM, doganad...@gmail.com wrote: > On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote: >> On 10/18/19 4:35 AM, doganad...@gmail.com wrote: >>> Here is my question: >>> >>> >>> I am using the numpy.std formula to calcul

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-18 Thread Richard Damon
On 10/18/19 9:45 AM, doganad...@gmail.com wrote: > On Friday, October 18, 2019 at 4:17:51 PM UTC+3, Richard Damon wrote: >> On 10/18/19 9:03 AM, doganad...@gmail.com wrote: >>> On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote: >>>> On 10/18/19

Re: What's the purpose the hook method showing in a class definition?

2019-10-20 Thread Richard Damon
#x27;t > find document about it also:-( > > --Jach The simple answer is that the attribute lookup happens at run time, not compile time (unlike some other languages). Thus attributes/member functions can be added by sub-classes, or even just to that instance at run time an

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-22 Thread Richard Damon
mber takes more space to represent than the exponential. 1.2E-05 takes 7 characters, 0.15 takes 8 so the exponential is shorter. As an aside, I would be very leery of numbers like 0.1 or 1e-05 as they only show 1 significant digit, so unless I have good reason to believe that they are exact numbers, I would have concern of them being very imprecise, and possibly just noise. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Richard Damon
mmunication between themselves, and you would need to manually add what ever communication was needed. A second option is to create a second thread, and do one if the imports in that thread, and one in the main thread. This is likely the closest to the stated goal, but likely, due to the GIL,

Re: nonlocal fails ?

2019-11-14 Thread Richard Damon
On Nov 14, 2019, at 12:18 PM, R.Wieser wrote: > > Rhodri, > >> MyVar is a global here, so nonlocal explicitly doesn't pick it up. > > I do not agree with you there (the variable being global). If it where than > I would have been able to alter the variable inside the procedure without > ha

Re: nonlocal fails ?

2019-11-14 Thread Richard Damon
> > On Nov 14, 2019, at 12:20 PM, R.Wieser wrote: > > MRAB, > >> 'nonlocal' is used where the function is nested in another function > > The problem is that that was not clear to me from the description - nor is > it logical to me why it exludes the main context from its use. > > Regards, >

Re: nonlocal fails ?

2019-11-14 Thread Richard Damon
> On Nov 14, 2019, at 12:56 PM, R.Wieser wrote: > > Jan, > >> So what you want to do is dynamic scope? > > No, not really.I was looking for method to let one procedure share a > variable with its caller - or callers, selectable by me. And as a "by > reference" argument does not seem t

Re: nonlocal fails ?

2019-11-14 Thread Richard Damon
   str = gstr + " Seen" # This function include a binding to gstr, so it is only looked for locally, #so this use will create an error that it can't find gstr, # even though it was defined in the global name space def getserror():     str = gstr + " Error"     gstr = str # This works because of the global statement, and updates the global def workingglobal():     global gstr     str = gstr + " Error"     gstr = str -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: nonlocal fails ?

2019-11-14 Thread Richard Damon
tion was looking for? > Handle it the same as any other mistake, and throw an error ? > > Regards, > Rudy Wieser > > -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: nonlocal fails ?

2019-11-15 Thread Richard Damon
to a different model, and I think it helps to accept that it is different rather than trying to keep trying to translate how Python does things into how some other language does it, as the latter make you focus on the things it can't do, not the things it can. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: nonlocal fails ?

2019-11-15 Thread Richard Damon
On 11/15/19 11:04 AM, Random832 wrote: > On Fri, Nov 15, 2019, at 10:48, Richard Damon wrote: >> On 11/15/19 6:56 AM, R.Wieser wrote: >>> There are quite a number of languages where /every/ type of argument >>> (including values) can be transfered "by referenc

Re: nonlocal fails ?

2019-11-15 Thread Richard Damon
return then elsewhere you could do foo(j) and after that j is 2 you also could do foo(1) and after that if you did j = 1 then now j might have the value 2 as the constant 1 was changed to the value 2 (this can cause great confusion) later I believe they added the ability to specify by value

Re: nonlocal fails ?

2019-11-15 Thread Richard Damon
On 11/15/19 12:21 PM, Random832 wrote: > On Fri, Nov 15, 2019, at 11:47, Richard Damon wrote: >> The issue with calling it a Reference, is that part of the meaning of a >> Reference is that it refers to a Object, and in Python, Names are >> conceptually something very much dif

Re: nonlocal fails ?

2019-11-17 Thread Richard Damon
ces, but that assignment, rather than being applied to the referred to object, re-seat the reference to point to the new object. As such, you can't get a reference to the name, to let one name re-seat where another name refers to. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: wordsearch

2019-11-19 Thread Richard Damon
Look at our code, and what controls the order you data is output. Change it so that the data is processed in the order you want the output. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: wordsearch

2019-11-19 Thread Richard Damon
On Nov 19, 2019, at 10:56 AM, Chris Angelico wrote: > > On Wed, Nov 20, 2019 at 2:46 AM wrote: >> >> Dne úterý 19. listopadu 2019 13:33:53 UTC+1 Richard Damon napsal(a): >>>> On 11/19/19 6:47 AM, jezka...@gmail.com wrote: >>>>> Hi, I have go

Re: nonlocal fails ?

2019-11-23 Thread Richard Damon
something fundamentally different than a box to hold a value. If you show names as boxes with arrows in them, someone is going to ask how to get one name point to another name (re the discussion about is it call by value or call by reference) -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Fit to function values with numpy/scipy

2019-11-25 Thread Richard Damon
a weighted average or weighted standard deviation, I don't know scipy to know if it has something like that built in. A quick scan shows that numpy.average allows a weighting array to be provided, so it shouldn't be hard to look at the code for sci[y.norm.fit and convert it to use weighted averages. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Pickle caching objects?

2019-11-30 Thread Richard Damon
ely using, as when objects go away there memory is returned to the free pool INSIDE Python, to be used for other requests before asking the OS for more. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: "Don't install on the system Python"

2019-12-01 Thread Richard Damon
ubles as some packages become incompatible because one needs a version greater than x, while another needs a version less than x. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Richard Damon
On Dec 2, 2019, at 12:32 PM, Chris Clark wrote: > > Test case: > > import array > array.array('L', [0]) > # x.itemsize == 8 rather than 4 > > This works fine (returns 4) under Windows Python 3.7.3 64-bit build. > > Under Ubuntu; Python 2.7.15rc1, 3.6.5, 3.70b3 64

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Richard Damon
types. Welcome to the ambiguity in the C type system, the basic types are NOT fixed in size. L means 'Long' and as Christian said, that is 8 byte long on Linux-64 bit. 'L' is exactly the right type for interfacing with a routine defined as taking a long. The issue is that you don

Re: urllib unqoute providing string mismatch between string found using os.walk (Python3)

2019-12-21 Thread Richard Damon
f codepoints, the o and U+0301 (the accent). If you want to make the strings compare equal then you need to make sure that you have normalized both strings the same way. I beleive that the Mac OS always converts file names into the NFD format when it uses them (that is what the first (a) string is in) -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Most elegant way to do something N times

2019-12-22 Thread Richard Damon
uld of course use something like a while loop to build this, but in my mind that is just making things less clear. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Lists And Missing Commas

2019-12-24 Thread Richard Damon
ical on some systems using fixed length lines, so allowing a constant to be built on multiple lines was useful. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Does the argparse generate a wrong help message?

2019-12-27 Thread Richard Damon
Can you elaborate on why you expect this? You've declared one of them to have a single mandatory argument, and the other a single optional argument. This corresponds to what I'm seeing. ChrisA So the square bracket means optional, not list? My misunderstanding:-( --Jach Yes, the norm

Re: Friday Finking: Source code organisation

2019-12-28 Thread Richard Damon
ule b needs resources from module a, it needs to import module a before it can use them. If module a also needs resources from module b, and imports it, then stuff from b might not be available while doing the running of module a that is defining the items in a. -- Richard Damon -- https:/

Re: Clarification on Immutability please

2020-01-22 Thread Richard Damon
p.mutate() can change the value of the shared object, but there is no way to make v refer to some new object. The key distinction is that in Python, names are NOT objects, they only bind to objects, and thus names can't refer to some other name to let us rebind them remotely. -- Richa

Re: Nested Loop Code Help

2020-01-26 Thread Richard Damon
mes (for starting values of count = 0, 1, 2, 3, 4, 5, 6, 7, 8 Think about what you wanted to do and what the code actually did. The first for x in range (0, 10) doesn't really do what I think you wanted, did you mean for the second loop to be nested in it? If you do nest the seco

Re: Nested Loop Code Help

2020-01-26 Thread Richard Damon
while loop, which would add x 'x's to the string. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Nested Loop Code Help

2020-01-26 Thread Richard Damon
;t solve his problem, as his expected was lines of 1 to 10 stars, not 0 to 9. Second, this smells a bit like homework, and if they haven't learned the results of string times integer, then using that operation wouldn't be in their tool kit, so having a loop to build that operator makes sense. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a character that never appears in the output of zlib.compress?

2020-01-29 Thread Richard Damon
be to take some byte value, (like FF) and where ever it occurs in the compressed data, replace it with a doubled value FF FF, and then add a single FF to the end. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Documentation of __hash__

2020-02-07 Thread Richard Damon
function, which uses some of the 'value' of the object, then presumably you intend for objects where that 'value' matches to be equal, which won't happen with the default __eq__. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Idiom for partial failures

2020-02-20 Thread Richard Damon
if the code was going to iterate through the success anyway, then there isn't as much of a cost to detect the errors that occured. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: ÿ in Unicode

2020-03-07 Thread Richard Damon
On 3/7/20 12:52 PM, Ben Bacarisse wrote: > moi writes: > >> Le samedi 7 mars 2020 16:41:10 UTC+1, R.Wieser a écrit : >>> Moi, >>> Fortunately, UTF-8 has not been created the Python devs. >>> >>> And there we go again, making vague statements/accusations - without >>> /anything/ to back it u

Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread Richard Damon
tive path, so the path is relative to the SERVER, not the current page, so it would be superhost.gr/mailform The other format goes through a function which might re-interpret the path and either make it page relative or add in the path of the current page to get to /test/mailform -- Ri

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Richard Damon
ce between words through the line. The varying spaces between words can be a bit annoying, but it was done. My thought is that variable width fonts tend to put more characters per inch. and with wider screens we are no longer trying as hard to keep to less than 80 characters per line (or

Re: Confusing textwrap parameters, and request for RE help

2020-03-26 Thread Richard Damon
> -- > Grant > > > Back in the day it was FREQUENTLY done, in part to show off, anyone could type with a typewriter and get jagged right margins, but with a computer you could get justified margins with uneven internal spacing!! Status! -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: What variable type is returned from Open()?

2020-04-16 Thread Richard Damon
it is more important if the object quacks like a duck then if it technically IS a duck. (And strangely, I believe you can have something that technically is a duck, but doesn't quack like one, as well as something totally unrelated to the duck type but quacks just like one). Files are such an animal, 'fileness' is not based on type, but on capability. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point problem

2020-04-20 Thread Richard Damon
ith reducing precision. With Binary floating point, you only have denormals near underflow. Now Decimal Floating point doesn't have this implied leading 1, but can have denormals at almost all of the ranges. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point problem

2020-04-21 Thread Richard Damon
oint number has only 1 significant digit (leading 0's are NOT significant), so the second smallest floating point number is twice that number. The key is that once you hit the denormals, you no longer have a relative accuracy like in the normal numbers, but all the denormals have the same absolute a

Re: why no camelCase in PEP 8?

2020-05-19 Thread Richard Damon
rs. > > grep '\bsnake_case\b *.py > > Barry > I think the issue is that you can easy search for all 'snake_case' and get them, but you have more difficulty searching for all 'camelCase', needing to go case insensitive, but if leading case matters (like there

Re: Getting value of a variable without changing the expression in Python

2020-05-21 Thread Richard Damon
a  veloctiy = solve(flowrate_fun, flowrate) i.e. you pass a function and it finds what input make the function have a give value. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Enums are Singletons - but not always?

2020-05-23 Thread Richard Damon
ou should be checking for equality (==) not identity (is) -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Data structures and Algorithms

2020-06-30 Thread Richard Damon
al structure of the Data Structure, and seeing the explicit pointers can be helpful here. Python may be better for the Algorithms side, where hiding some of the gritty detail can be more useful, though that hiding might obscure some details if you want to think about what is the complexity of an

Re: Confused about np.polyfit()

2020-07-19 Thread Richard Damon
ng to a polynomial is that you can get a closed form set of equations to solve to find the 'optimal' values. The primary effect of transforming the data before doing the fit is the error is now defined in terms of the difference of the transformed values, not the original values. In many cases, this is actually a reasonable way to define your error, so it works. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: questions re: calendar module

2020-08-02 Thread Richard Damon
that you may want to trim them out when possible. I would likely just build the formatter to start by assuming 6 week months, and then near the end, after stacking the side by side months, see if it can be trimmed out (easier to remove at the end then add if needed) -- Richard Damon

Re: questions re: calendar module

2020-08-02 Thread Richard Damon
27;Academic' calendars that might start in July or August and go to maybe the following September -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: questions re: calendar module

2020-08-02 Thread Richard Damon
iar with what you are doing. The second method would be to write a program to do this. Maybe use the 'canned' routine as a base for the program, but accept that your actual desired output is unusual enough it won't be something you can get with a single call. Maybe accept you can't get exactly what you want, so be willing to accept something close. Maybe the chart goes from January of your start year to December of the final year if the library likes doing a full year at a time. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Are instances of user-defined classes mutable?

2020-08-06 Thread Richard Damon
s that requirement. To find that element in the dictionary, you would need to build a tuple using that exact same me object, you couldn't create another object, and set it to the same 'value', as they won't compare equal. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Are instances of user-defined classes mutable?

2020-08-06 Thread Richard Damon
>): 23} >>>>> hash(h) >> 2 >>>>> hash(list(d.keys())[0]) >> -3550055125485641917 >>>>> h.a=33 >>>>> hash(list(d.keys())[0]) >> -3656087029879219665 >>>>> > so the dict itself doesn't enforce immutability of its keys Yes, here you have defined a hash that violates the requirements of the Dictionary (and most things that use hashes) so your class is broken, and you can expect to get strangeness out of your dictionary. > -- > Robin Becker > -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-06 Thread Richard Damon
ce you are not using an iterator of the list, changing it shouldn't cause any problems. You loop (for its control) looks at the loop once, before it starts, so as long as you don't delete any elements (which would cause the index to go to high) you can't have an issue mutating the li

Re: Are instances of user-defined classes mutable?

2020-08-07 Thread Richard Damon
at least to the tuple, immutable, as the only part of it that matters is the value of id() which WILL be unchanging. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-07 Thread Richard Damon
e of statement, so = can't be misused in an expression thinking it means an equality test (and then added recently the := operator, so that for the cases you actually want to do assignments in the middle of an expression you can). -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-07 Thread Richard Damon
n alleviate some of the issues (at other costs). -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-07 Thread Richard Damon
nal are all available for free and the last published draft standard is almost always virtually identical to the final released standard, so most people will just use those. People who really need the official versions can pay the price for it, and for them, that price isn't that high to them). I

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-07 Thread Richard Damon
ng basically the iterative solution, so that the recursive call to fir(0, ...) doesn't actually calculate the fib(0) value, but fib(n). Yes, this shows that you can convert an iterative solution into a recursive solution with a bit of hand waving, but you still end up with a program based on th

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-07 Thread Richard Damon
On 8/7/20 3:54 PM, Marco Sulla wrote: > On Fri, 7 Aug 2020 at 19:48, Richard Damon wrote: >> The difference is that the two languages define 'expression' differently. >> [...] > I don't know if this is interesting or pertinent to the topic. > > Christian Se

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-07 Thread Richard Damon
On 8/7/20 6:55 PM, Marco Sulla wrote: > On Sat, 8 Aug 2020 at 00:28, Richard Damon wrote: >> The really interesting part is that since Lisp programs manipulate lists >> as data, and the program is just a list, Lisp programs have the >> theoretical ability to edit the

Re: Including a Variable In the HTML Tags When Sending An Email

2020-08-08 Thread Richard Damon
#x27;Cc'] = ', '.join(CC_Address) > msg['Subject'] = Subject_Email > > message = MIMEText(html,'html') > msg.attach(message) > mail.sendmail(From_Address, (To_Address + CC_Address), msg.as_string()) > [/python] > > In this case the variable Name is Tom and i want to include Tom in the email. > > Can anyone help? > > Still a newbie; approx 3 weeks playing with Python (cut and past most of this > code) > > Any help will be greatly appericated. > > Thank you. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Including a Variable In the HTML Tags When Sending An Email

2020-08-08 Thread Richard Damon
ld i include this variable in my HTML/Python code? > > Any ideas? > > Thank you. Since you are already using .format to insert the message body, you might as well do something similar to insert the name, adding more placeholders for the format to insert into. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Including a Variable In the HTML Tags When Sending An Email

2020-08-08 Thread Richard Damon
ted differently to get them into clean html. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Including a Variable In the HTML Tags When Sending An Email

2020-08-09 Thread Richard Damon
On 8/9/20 6:22 PM, sammy.jackson...@gmail.com wrote: > On Sunday, August 9, 2020 at 1:32:30 AM UTC+1, Richard Damon wrote: >> On 8/8/20 8:03 PM, sammy.jackson...@gmail.com wrote: >>> If i use place holders i.e. {0} and {1} where {0} is the name and {1} is >>> the dataf

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-15 Thread Richard Damon
A few comments come to mind about this discussion about TCO. First, TCO, Tail Call Optimization, is talking about something that is an optimization. Optimizations, are generally some OPTIONAL improvement in the method of executing the code that doesn't alter its DEFINED meaning. First big point,

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Richard Damon
asking how would it feel to be that 'slave node', maybe even needing to wait for your 'master' to ask before you went to the bathroom, or be considered to be 'malfunctioning'. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Richard Damon
er power, it has no authority, except might, to enforce it. If we accept might as the right and power to rule, we need to accept that it was and will be the right and power, and accept what it brought and will bring. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: About float/double type number in range.

2020-08-26 Thread Richard Damon
ou get the expected value) or slightly lower (where you would get the top 'excluded' value listed). This sort of unpredictability is part of the difficulty dealing with floating point. As was pointed out, you can scale the range, or build your own generator to get what you want. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why __hash__() does not return an UUID4?

2020-08-26 Thread Richard Damon
Since the typical use of hash will be followed by a real equality test if the hashes match, we don't need the level of a UUID -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why __hash__() does not return an UUID4?

2020-08-26 Thread Richard Damon
sh(y) were random numbers, then how would this property be maintained? > > Or do UUID4 mean something else to you than a random number? Looking up which UUID type 4 is, yes it is a random number, so could only be applicable for objects that currently return id(), which could instead make id

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Richard Damon
of this, the Python 3 str type is not suitable to store an email message, since it insists on the string being Unicode encoded, but the Python 2 str class could hold it. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
; >> Are we saying that Python 3 really can't be made to handle things >> 'tolerantly' like Python 2 used to? > It sure should be possible but it will require *explicit* en/decode()s in > more places than before because AFAICT there's less impliciteness as to &

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
x27; does make sure that the program is handling all the text 'properly', and would be helpful if some of the patterns being checked for contained 'extended' (non-ASCII) characters. One possible solution in Python3 is to decode the byte string using an encoding that allows all 25

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 8:39 AM, Chris Green wrote: > Richard Damon wrote: >> On 8/28/20 7:50 AM, Karsten Hilbert wrote: >>>>> No interpreation requires, since parsing failed. Then you can start >>>>> dealing with these exceptions. _Do not_ write unparsable messages

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
I want Python 3's mailbox class to juyst put what I tell it (even if > mis-formatted or mis-encoded) into the mbox. > It looks like the mailbox class has gotten 'pickier' in Python 3, and won't accept a message as a byte string, just as either a email message or a real string. My guess would be that 'simplest' path would be to convert your message into a parsed Message class, and add that. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Richard Damon
: ordinal not in range(128) > > Any message with other than ASCII in it is going to have bytes >128 > unless it's encoded some way to make it 7-bit and that's not going to > happen in the general case. > When I took a quick look at the mailbox class, it said it could take a 'string', or a 'message'. It may well be that the string option assumes ASCII. You may need to use the message parsing options of message to convert messages with extended characters into the right format. This is one of the cases where Python 2's non-strictness made things easier, but also much easier to get wrong if not careful. Python 3 is basically making you do more work to make sure you are doing it right. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Richard Damon
om:" depending on which mailbox format is being used. There may be a few other small details that needs to happen to. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Symlinks already present

2020-08-31 Thread Richard Damon
explicit with the reference of implicit via the current working directory. That can define what is the parent. Yes, that says that two references to the 'same' directory (same as in same inode, but different paths) will find a different value for .. in it. So the definition of .. can be well defined, even in the presence of multiple parent directories. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Symlinks already present

2020-08-31 Thread Richard Damon
On 8/31/20 9:00 AM, Chris Angelico wrote: > On Mon, Aug 31, 2020 at 9:57 PM Richard Damon > wrote: >> On 8/31/20 3:35 AM, Chris Angelico wrote: >>> On Mon, Aug 31, 2020 at 5:28 PM Cameron Simpson wrote: >>>>> Because of the ".." issue, it'

Re: Symlinks already present

2020-08-31 Thread Richard Damon
; Barry > This is based on a hypothetical OS that allows creating hard-links to directories, just like to files. Because current *nix system don't do it this way, they don't allow hard-links to directories because it does cause this sort of issue. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Symlinks already present

2020-08-31 Thread Richard Damon
On 8/31/20 12:49 PM, Chris Angelico wrote: > On Tue, Sep 1, 2020 at 2:40 AM Richard Damon wrote: >> On 8/31/20 9:00 AM, Chris Angelico wrote: >>> That's incompatible with the normal meaning of "..", and it also >>> implies that any time you rename any

Re: Symlinks already present

2020-09-01 Thread Richard Damon
On 8/31/20 6:05 PM, Chris Angelico wrote: > On Tue, Sep 1, 2020 at 5:08 AM Richard Damon wrote: >> The file descriptor could remember the path used to get to it. chroot >> shows that .. needs to be somewhat special, as it needs to go away for >> anyone that . is their current

Re: Symlinks already present

2020-09-01 Thread Richard Damon
On 9/1/20 9:03 AM, Chris Angelico wrote: > On Tue, Sep 1, 2020 at 10:57 PM Richard Damon > wrote: >> On 8/31/20 6:05 PM, Chris Angelico wrote: >>> On Tue, Sep 1, 2020 at 5:08 AM Richard Damon >>> wrote: >>>> The file descriptor could remember the path

Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-08 Thread Richard Damon
arted as _list[2], and with your code, when he gets half way done he will hit an index error as he tries to delete _list[26] from a list with only 25 elements. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Your confirmation is required to join the Python-list mailing list

2020-09-10 Thread Richard Damon
Jovial Lian > Sounds like you keep re-running the installer rather than the installed version of python. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Puzzling difference between lists and tuples

2020-09-17 Thread Richard Damon
Parenthesis don't always make a tuple (and in fact aren't needed to make them) ('first') is just the string value 'first', inside a set of parenthesis to possible affect order of operations. For 1 element tuples, you need a trailing comma, like ('first,) and in many places it also could be just 'first', just like your first example could be just for n in 'first', 'second': -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Use of a variable in parent loop

2020-09-27 Thread Richard Damon
s, functions and classes have a scope, control structures do not. If control structures created a scope it would be ugly. You do need to watch out about the difference between classical 'variables' and pythons name binding when you deal with mutable objects; For example: a = [] b = a a.append(1) print(b) give [1] as a and b are bound to the same object, even though you want to think of them as different variables. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Help! I broke python 3.9 installation on macOS

2020-10-08 Thread Richard Damon
On 10/8/20 7:31 PM, Elliott Roper wrote: > First problem: I can no longer say > Obfuscated@MyMac ~ % python3 pip -m list isn't that supposed to be python3 -m pip list -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread Richard Damon
;t see much need for: import MODULE from MODULE import * as if you are bringing in ALL the names into the current module name space, when will you need to use the module.symbol notation? -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a conflict of libraries here?

2020-11-08 Thread Richard Damon
talized name, and avoid the name conflict. It just says that in your code, to use the class you either need to use Datatime or datetime.datetime -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: tkinter global variable

2020-11-13 Thread Richard Damon
k. I got the point. So what do I need to do access the variable? How do > I return a value from that function? > > Thanks. The problem is that you are accessing the variable BEFORE the box has been put up and the user clicking on it. That doesn't happen until the mainloop() call. You need to delay the opening and reading of the file till the filedialog has been used and returned. Perhaps on_openfile could open and read the file. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: tkinter global variable

2020-11-13 Thread Richard Damon
On 11/13/20 12:12 PM, ChalaoAdda wrote: > On Fri, 13 Nov 2020 12:04:53 -0500, Richard Damon wrote: > >> On 11/13/20 11:42 AM, ChalaoAdda wrote: >>> On Fri, 13 Nov 2020 16:04:03 +, Stefan Ram wrote: >>> >>>> ChalaoAdda writes: >>>>

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
it meets the SYNTAX of an email address isn't THAT hard, but there are a number of edge cases to worry about. Validating that it is a working email address (presumably after verifying that it has a proper syntax) is much harder, and basically requires trying to send to the address, and to really conf

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
in comments or display names, but just a base email address isn't that hard). Many people do still get it wrong. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
terns is probably beyond what a regex could handle. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: A random word from one of two lists

2021-01-01 Thread Richard Damon
> kangaroo > > -- > Thanks random.choice doesn't return 'a variable' but an object. Which is the same object that one of the variables that you used. IF you wanted to use words, then you could have made kinds = {'animals', 'fruits'} and

<    1   2   3   4   >