Re: f-string

2017-12-06 Thread Steve D'Aprano
On Wed, 6 Dec 2017 12:21 pm, Chris Angelico wrote: > On Wed, Dec 6, 2017 at 11:54 AM, John Pote > wrote: >> >> On 06/12/2017 00:16, Steve D'Aprano wrote: >>> >>> Anyone got a handy copy of Python 3.6 available to test something for me? >>> >

Re: we want python software

2017-12-06 Thread Steve D'Aprano
pectations, than to downgrade my expectations and coddle them into a spiral of lower and lower competence and ability. (By the way Rustom, if you're reading, thank you for that link to the video a few weeks ago about teaching 2 + 2 = 22. My blood pressure just about doubled watching it.)

Re: we want python software

2017-12-06 Thread Steve D'Aprano
"Download Python" because he thinks it is proprietary software and wants a bunch of strangers on the Internet to send him a pirate copy? I'm not entirely sure that's better... -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] [RELEASE] Python 3.6.4rc1 and 3.7.0a3 now available for testing

2017-12-06 Thread Steve Holden
enjoy it. Seasons greetings Steve Steve Holden On Wed, Dec 6, 2017 at 2:29 AM, Ned Deily wrote: > Announcing the immediate availability of Python 3.6.4 release candidate 1 > and of Python 3.7.0 alpha 3! > > Python 3.6.4rc1 is the first release candidate for Python 3.6.4, the next >

Re: csv.DictReader line skipping should be considered a bug?

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 02:33 am, Dennis Lee Bieber wrote: > On Wed, 06 Dec 2017 11:06:39 +1100, Steve D'Aprano > declaimed the following: > > >>I wouldn't want to guess your mental health based just on this isolated >>incident, but if I had to make a diagno

Re: Politeness (was: we want python software)

2017-12-06 Thread Steve D'Aprano
On Wed, 6 Dec 2017 11:25 pm, Rustom Mody wrote: > On Wednesday, December 6, 2017 at 4:05:43 PM UTC+5:30, Steve D'Aprano wrote: >> On Wed, 6 Dec 2017 02:49 pm, Rustom Mody wrote: >> >> > You are assuming that the strangeness of the request is about 'tech' &

Re: we want python software

2017-12-06 Thread Steve D'Aprano
[2] Given the historical practice of suttee (sati) and the questions it raises about colonial imperialism[3], as well as the still-current practice of dowry murder[4] and even more vicious crimes[5] in India, accusing KM of setting another person on fire (even metaphorically) is not something I'd do so casually. [3] http://www.victorianweb.org/history/empire/india/suttee.html [4] https://preview.tinyurl.com/y86vglvm [5] https://preview.tinyurl.com/hnaa29w -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Module _socket not found in python3.6 "No module named _socket"

2017-12-06 Thread Steve D'Aprano
tderr.) Trivial steps that you are sure are correct can be summarised (e.g. "Downloaded Python3.6.tar.gz, unpacked it, and cd'ed into the resulting directory") but if you have any doubt that you are doing it correctly, better to post too much information than not enough. -

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 08:22 am, Python wrote: > On Wed, Dec 06, 2017 at 10:35:58AM +1100, Steve D'Aprano wrote: >> On Tue, 5 Dec 2017 07:58 pm, Lawrence D’Oliveiro wrote: >> >> > On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote: >>

Re: Round to 2 decimal places

2017-12-06 Thread Steve D'Aprano
t can be cut down to just: volume = 2345.987654321 # for example print(volume) We can round the result first, then print it: print(round(volume, 2)) or we can change the display by using string formatting: print("%.2f" % volume) print("{:.2f}".format(volume)) --

Re: Round to 2 decimal places

2017-12-06 Thread Steve D'Aprano
ot;>>>" (without the quotes) or something similar to "In [1]:" then copy these two lines to the prompt and hit ENTER: volume = 257.148345678 print(round(volume, 2)) Either way, reply here with the output. Make sure you copy it. -- Steve “Cheer up,” they said, “things could

f-string

2017-12-08 Thread Steve D'Aprano
Anyone got a handy copy of Python 3.6 available to test something for me? What does compile('f"{spam} {eggs}"', '', 'single') return? What does eval()'ing the above compiled object do? If necessary, you may have to define spam and eggs first. Thank

Re: Please tell me how to execute python file in Ubuntu by double click

2017-12-08 Thread Steve D'Aprano
ile associations, then you should have said so. But why do you care about the kernel? Would you think it even the *tiniest* useful to claim that "Linux doesn't do email" because it is sendmail or postfix (or similar) that sends email rather than the Linux kernel itself? -- Steve --

Re: csv.DictReader line skipping should be considered a bug?

2017-12-08 Thread Steve D'Aprano
ract the records* as a dict. Since blank lines aren't records, they should be skipped. > Does anyone agree, or am I crazy? I wouldn't want to guess your mental health based just on this isolated incident, but if I had to make a diagnosis, I'd say, yes, crazy as a loon. *wink* -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: we want python software

2017-12-08 Thread Steve D'Aprano
pectations, than to downgrade my expectations and coddle them into a spiral of lower and lower competence and ability. (By the way Rustom, if you're reading, thank you for that link to the video a few weeks ago about teaching 2 + 2 = 22. My blood pressure just about doubled watching it

Re: f-string

2017-12-08 Thread Steve D'Aprano
On Wed, 6 Dec 2017 12:21 pm, Chris Angelico wrote: > On Wed, Dec 6, 2017 at 11:54 AM, John Pote > wrote: >> >> On 06/12/2017 00:16, Steve D'Aprano wrote: >>> >>> Anyone got a handy copy of Python 3.6 available to test something for me? >>> >

Re: f-string

2017-12-08 Thread Steve D'Aprano
On Wed, 6 Dec 2017 11:54 am, John Pote wrote: [...] > Ran above test file and got, > >>python36 compiletest.py > at 0x02120E40, file "", line 1> > > > SPAM scrambled Thanks everyone, that's what I wanted to see. -- Steve â £Cheer up,â Ø th

Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-12-09 Thread Steve D'Aprano
of Python. http://www.fiber-space.de/EasyExtend/doc/teuton/teuton.htm http://www.chinesepython.org/english/english.html My *guess* is that Teuton is intended as a proof-of-concept just to show it can be done, and ChinesePython is intended for students. -- Steve “Cheer up,” they said, “things c

Re: Benefits of unicode identifiers (was: Allow additional

2017-12-09 Thread Steve D'Aprano
the tens of hundreds of thousands of other projects (including *enormous* projects like the Linux kernel, LibreOffice, Apache, Mozilla, etc) will all say "well, that's it, we're shutting down"? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Steve D'Aprano
and they aren't Ubuntu, so they aren't relevant. > Though, providing such precision via natural > language often turns out to be more challenging than one would hope... Indeed. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Steve D'Aprano
On Sun, 10 Dec 2017 02:01 pm, Chris Angelico wrote: > On Sun, Dec 10, 2017 at 12:56 PM, Steve D'Aprano > wrote: >> Remember the context here: we're replying to a thread discussing somebody >> who is running Ubuntu with a GUI desktop environment. Of course there are &

Re: Save and load initialized class

2017-12-10 Thread Steve D'Aprano
On Sun, 10 Dec 2017 04:52 am, MRAB wrote: > Try updating __dict__: > > Opts.__dict__.update(json.load(open("mybuffer"))) __dict__ is implementation, vars() is the public interface: vars(Opts).update(json.load(open("mybuffer"))) Looks nicer too :-) --

Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-10 Thread Steve D'Aprano
magic can tell us a lot about > what a file contains. > > man 5 magic https://pypi.python.org/pypi/python-magic -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: write your replace function in python

2017-12-14 Thread Steve D'Aprano
with spaces".replace(" ", "hyphen") When in doubt, open the Python interpreter to a command prompt ">>> " and enter: help("") to see the string methods. Other commands work too: help(str.replace) -- Steve “Cheer up,” they said, “things could

Re: unabe to import /pyd file.

2017-12-15 Thread Steve D'Aprano
fails Windows supports / as directory separator. You should use / as the directory separator in your source code, and let the OS convert them to backslashes. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-15 Thread Steve D'Aprano
They are still supported (-ish) by OS X, but have been superseded by Uniform Type Identifiers. https://en.wikipedia.org/wiki/Uniform_Type_Identifier -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem with timeit

2017-12-15 Thread Steve D'Aprano
t; Timer("x = n**n", "n = 123456").timeit(10) 18.006236914545298 As you can see, repeating the calculation 10 times doesn't take exactly ten times as long as doing the calculation once. That could be because the garbage collector runs. The more expensive the calculation, t

Re: Problem with timeit

2017-12-15 Thread Steve D'Aprano
t; Timer("x=123456**123456").timeit(10**6) > 0.00969144597183913 Calculating BigInt exponentiation is fast, but its not that fast once you get to hundreds of thousands of digits. That calculates the 600,000+ digit number 123456**123456 once, at compile time, then simply assigns that huge number to x a million times. So you would likely get almost the same result by running: Timer("x=17").timeit(10**6) -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem with timeit

2017-12-15 Thread Steve D'Aprano
es the big int 123456**123456 while it is compiling the entire command line, so that happens *before* the time starts. The assignment is so fast that the three statements: t = time() x = 5...6 # huge number, pre-calculated print(time() - t) essentially occurs faster than the resolution of time.

Re: Problem with timeit

2017-12-19 Thread Steve D'Aprano
ous) > > so 628578 digits Nice! It also works with other bases: py> x = 10**100 py> math.log(x, 2) 3321928.0948873623 py> x.bit_length() 3321929 Today I learned. Thank you. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things

Re: correctness proof for alpha-beta algorithm

2017-12-19 Thread Steve D'Aprano
from an on-topic post. But in future, if you're going to *start* an off-topic thread from the first post, it would be polite to label it such with an "[OT]" or "Off-topic" prefix to the subject line. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up,

[META] Are the list admins honouring Posting Prohibited demands?

2017-12-19 Thread Steve D'Aprano
or a direct consequence of his demand? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: correctness proof for alpha-beta algorithm

2017-12-20 Thread Steve D'Aprano
On Thu, 21 Dec 2017 08:37 am, Bill wrote: > namenobodywa...@gmail.com wrote: >> On Tuesday, December 19, 2017 at 3:28:39 PM UTC-8, Steve D'Aprano wrote: >> >>> Does this have anything specifically to do with Python programming? >> i'm working on a game-p

Re: How to edit a function in an interactive python session?

2017-12-20 Thread Steve D'Aprano
unctionality. Or you could try creating your own. This might be a good place to start: https://mail.python.org/pipermail/python-list/2014-September/677841.html http://code.activestate.com/recipes/578926-call-out-to-an-external-editor/ Read the full thread -- it has lots of useful information.

Re: Why "flat is better than nested"?

2017-12-22 Thread Steve D'Aprano
data has named fields (e.g. C struct, Pascal record, object with named attributes, Python named tuple, CSV file with descriptive column headers); - unstructured data does not name the fields (e.g. a plain tuple, CSV file without column headers) and you have to infer the meaning of each fie

Re: Where is ^ (symmetric_difference) documented in help()?

2017-12-22 Thread Steve D'Aprano
t; s ^ t You can call: help("^") (notice you need to quote the operator) but it only talks about the bitwise operators. I've just raised bug report for this: https://bugs.python.org/issue32412 -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sur

Re: Where is ^ (symmetric_difference) documented in help()?

2017-12-22 Thread Steve D'Aprano
.org/2/reference/datamodel.html#emulating-numeric-types to learn that you must override __xor__ to override the ^ operator. It isn't really clear from the documentation that the set operator ^ is implemented by __xor__ (and also __rxor__). Perhaps you can suggest a documentation patch? -- S

Re: Why are both locals() and globals() set?

2017-12-22 Thread Steve D'Aprano
global x x = 1 rather than trying to play around with globals() and locals(). -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: What is the meaning of @@?

2017-12-22 Thread Steve D'Aprano
d to see whether it is really needed or not. Where did you find @@ in Python? (By the way, @ for matrix multiplication only works in Python 3.5 or better.) https://www.python.org/dev/peps/pep-0465/ -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, th

Re: Writing a chess-playing AI like Alphago in Python

2017-12-23 Thread Steve D'Aprano
Python: https://github.com/pasky/michi but I don't believe it does any machine learning. See also: https://github.com/rossumai/nochi https://medium.com/rossum/building-our-own-version-of-alphago-zero-b918642bd2b5 -- Steve “Cheer up,” they said, “things could be worse.” So I cheered u

Automatic Gain Control in Python?

2022-05-28 Thread Steve GS
I have an extensive Excel/VBA program that hourly calls and plays podcasts through a "smart" speaker. The output of the speaker feeds into another computer that records the m\audio using Audacity. It has become obvious that NPR does not regulate volumes for podcasts and broadcasts nor are programs

RE: Automatic Gain Control in Python?

2022-05-28 Thread Steve GS
hes. Me: I wish I could. -Original Message- From: Python-list On Behalf Of Richard Damon Sent: Saturday, May 28, 2022 6:53 PM To: python-list@python.org Subject: Re: Automatic Gain Control in Python? On 5/28/22 5:29 PM, Steve GS wrote: > I have an extensive Excel/VBA program that hou

RE: Automatic Gain Control in Python?

2022-05-28 Thread Steve GS
ct: Re: Automatic Gain Control in Python? On 2022-05-29 01:17, Steve GS wrote: > "My first thought is you are solving the wrong problem. What seems a > better option would be to get your code to actually connect up to the > podcast and just download the audio directly, rather than trying

RE: Automatic Gain Control in Python?

2022-05-28 Thread Steve GS
th orange?” “No, it doesn’t..” -Original Message- From: Richard Damon On Behalf Of Richard Damon Sent: Saturday, May 28, 2022 11:37 PM To: Steve GS Subject: Re: Automatic Gain Control in Python? On 5/28/22 8:17 PM, Steve GS wrote: > "My first thought is you are solving the wron

RE: Automatic Gain Control in Python?

2022-05-29 Thread Steve GS
not sure what you are doing is actually legitimate. Yes, I have been through that. It is totally legal to record NPR broadcasts for replay as long as they are not retained for than a month or for multiple replays. Your suggestion to download and play a podcast or broadcast is legal only for li

RE: Automatic Gain Control in Python?

2022-05-29 Thread Steve GS
wish for more wishes. Me: I wish I could. From: Benjamin Schollnick Sent: Sunday, May 29, 2022 11:18 AM To: Steve GS Cc: Richard Damon ; Python Subject: Re: Automatic Gain Control in Python? Okay, you are capturing the audio stream as a digital file somewhere, correct? Why not just

RE: Automatic Gain Control in Python?

2022-05-31 Thread Steve GS
>Even easier, the few NPR podcasts I just checked now have RSS feeds of their episodes (as expected). It seems it would be much easier to just download the latest episode based on the XML file, normalize, send it to play, done. How can that possibly be easier? I am playing the podcast and r

RE: Automatic Gain Control in Python?

2022-05-31 Thread Steve GS
-list On Behalf Of MRAB Sent: Tuesday, May 31, 2022 9:47 PM To: python-list@python.org Subject: Re: Automatic Gain Control in Python? On 2022-06-01 02:03, Steve GS wrote: [snip] > Maybe you do not understand smart speakers. That is exactly what they do. > You tell them what podcast/broadcast t

RE: Automatic Gain Control in Python?

2022-06-06 Thread Steve GS
Yes, it is real-time play back of a pre-recorded presentation. A juke box does the same thing. It plays records. You didn't put your quarter in to expect the band to play your piece live, did you? Same here, I am pulling in the programs and playing them for an audience. All I want to do is have s

Subtracting dates to get hours and minutes

2022-12-11 Thread Steve GS
How do I subtract two time/dates and calculate the hours and minutes between? Steve -- https://mail.python.org/mailman/listinfo/python-list

Style qeustion: Multiple return values

2021-04-12 Thread Steve Keller
Just a short style question: When returning multiple return values, do you use parenthesis? E.g. would you write def foo(): return 1, 2 a, b = foo() or do you prefer def foo(): return (1, 2) (a, b) = foo() Steve -- https://mail.python.org/mailman/listinfo

Different "look and feel" of some built-in functions

2021-09-24 Thread Steve Keller
to use a * instead set.union(*map(...)) etc. Is this just for historical reason? And wouldn't it be possible and desirable to have more consistency? Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Steve Keller
"Dieter Maurer" writes: > Steve Keller wrote at 2021-9-24 11:48 +0200: > >Why do some built-in Python functions feel so differently: > > Because the typical use cases are different > > [...] > > >while other functions like set.union() and set.intersect

sum() vs. loop

2021-10-11 Thread Steve Keller
I generate about 14 million pairs of sequences of ints each of length 15 which need to be summed. The first version with sum() needs 44 seconds while the second version runs in 37 seconds. Can someone explain this difference? Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: sum() vs. loop

2021-10-11 Thread Steve Keller
, of course. Much cleaner and I should have seen that myself. Thanks. BUT > (untested) ? I have tested it and with () instead of [] it's even slower: explicit loop: 37s ± .5s sum([...]) 44s ± .5s sum((...)) 47.5s ± .5s Now completely surprised. Steve -- https://mail.python.org/mailman/listinfo/python-list

JSON confusion

2016-08-17 Thread Steve Simmons
I'm trying to write a small utility to find the closest railway station to a given (UK) postcode but the result is in JSON and I'm not familiar with it. I've got as far as extracting the JSON object and I can print the first level elements ("success" and "result") but I've totally confused myse

Re: JSON confusion

2016-08-17 Thread Steve Simmons
On 17/08/2016 17:49, Jon Ribbens wrote: On 2016-08-17, Steve Simmons wrote: I'm trying to write a small utility to find the closest railway station to a given (UK) postcode but the result is in JSON and I'm not familiar with it. I've got as far as extracting the JSON object

Re: type lookuperror

2016-08-18 Thread Steve D'Aprano
consider doing the tutorial. For version 3: https://docs.python.org/3/tutorial/ For version 2: https://docs.python.org/2/tutorial/ -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: type lookuperror

2016-08-18 Thread Steve D'Aprano
ed charities and religions. The best part of it is, how could you tell whether or not your CBP is living up to their service guarantees? If they're not, you literally will be incapable of thinking that you are unsatisfied with their service. I can hardly wait. [1] Conditions apply. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: integer's methods

2016-08-18 Thread Steve D'Aprano
. Try: (123).bit_length() 123 .bit_length() instead. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Nuitka Release 0.5.22

2016-08-19 Thread Steve D'Aprano
On Thu, 18 Aug 2016 06:58 am, breamore...@gmail.com wrote: > As Kay (him) is less than useless at sales and marketing, somebody has to > do it, so here you are folks > http://nuitka.net/posts/nuitka-release-0522.html Thanks for the link. -- Steve “Cheer up,” they said, “things could

Re: index for regex.search() beyond which the RE engine will not go.

2016-08-19 Thread Steve D'Aprano
e "endpos" parameter tells the RE engine to stop at that position if the regex isn't found before it. It won't go beyond that point. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: index for regex.search() beyond which the RE engine will not go.

2016-08-19 Thread Steve D'Aprano
not be English, and that he or she may not understand how regular expression matching works. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: saving octet-stream png file

2016-08-19 Thread Steve D'Aprano
ler. See: https://isocpp.org/wiki/faq/intrinsic-types http://stackoverflow.com/questions/5516044/system-where-1-byte-8-bit http://stackoverflow.com/questions/2098149/what-platforms-have-something-other-than-8-bit-char http://programmers.stackexchange.com/questions/120126/what-is-the-history-of-why-byt

Re: Holding until next value change

2016-08-19 Thread Steve D'Aprano
ore_negative: ignore_positive, ignore_positive: ignore_nothing, } And some code to drive it: state = ignore_negative # DON'T call the function yet for value in main_call(): print(value) # for testing if state(value): print("changing state") state

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
("PS_SURFACE", "ps_surface_create"), ("RECORDING_SURFACE", "recording_surface_create"), ("SCRIPT_SURFACE", "script_create"), ("SVG_SURFACE", "svg_surface_create"), ("USER_FONT", "user_font_face_create"), ]: setattr(HAS, symname, hasattr(cairo, "cairo_" + funcname)) There's no need to arbitrarily indent parts of expressions to "allow easy additions" in the future: it is already easy to add new tuples to the table, or modify existing ones. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
On Sun, 21 Aug 2016 09:44 am, Lawrence D’Oliveiro wrote: > Why do you think I put in those “#end” lines? Do you really want us to answer that? I don't think you will like the answer. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, th

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
e that using any() or all() was not a good idea because, and I quote: "There is no short-cut evaluation when constructing tuples and lists." I think that he is envisaging a scenario where (say) src and mask are defined, but dest is not, so [src, mask, dest] will raise a NameErro

Re: Two-Dimensional Expression Layout

2016-08-20 Thread Steve D'Aprano
ally and give a more useful error message: def _validate(src, mask, dest): if not isinstance(src, Image): raise TypeError("src must be an Image") if mask is not None and not isinstance(mask, Image): raise TypeError("mask must be None or an Image") if not isinstance(dest, Image): raise TypeError("dest must be an Image") -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Does This Scare You?

2016-08-21 Thread Steve D'Aprano
n your boots over a simple bug in a non-critical library, how about reporting these cases on the bug tracker with an explanation of the problem? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Does This Scare You?

2016-08-22 Thread Steve D'Aprano
On Mon, 22 Aug 2016 08:33 pm, Jon Ribbens wrote: > On 2016-08-22, Steve D'Aprano wrote: >> On Mon, 22 Aug 2016 10:38 am, eryk sun wrote: >>> To me it's scary that this check misses cases because it's trying to >>> be cross-platform instead of simply rel

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Steve D'Aprano
l, you can't have such a program. But even if you could, why would you want it? > The fact that there has been all this much discussion over specific code > to me enforces the need for a simple an uniform mechanism. There's only been this much discussion because you raised th

Re: Does This Scare You?

2016-08-22 Thread Steve D'Aprano
On Mon, 22 Aug 2016 09:50 pm, Jon Ribbens wrote: > On 2016-08-22, Chris Angelico wrote: >> On Mon, Aug 22, 2016 at 8:33 PM, Jon Ribbens >> wrote: >>> On 2016-08-22, Steve D'Aprano wrote: >>>> On Mon, 22 Aug 2016 10:38 am, eryk sun wrote: >>&g

Re: PEP suggestion: Uniform way to indicate Python language version

2016-08-22 Thread Steve D'Aprano
On Mon, 22 Aug 2016 10:52 pm, Random832 wrote: > On Mon, Aug 22, 2016, at 08:44, Chris Angelico wrote: >> However, I don't think it's particularly necessary. Explicit version >> number checks should be very rare, and shouldn't be encouraged. >> Instead, enc

Re: Does This Scare You?

2016-08-22 Thread Steve D'Aprano
; "C:\con\con" trick, which crashed the system by trying to use the name > as a directory. \con\con hasn't been an issue since Windows 98. If you're running your web application under Win 98, you deserve to be blue-screened :-) -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Does This Scare You?

2016-08-22 Thread Steve D'Aprano
f so, how do you see this attack working? (Existing filename-based attacks are not new.) I don't see what the issue is. Eryksun found a bug in pathlib, well done. (I mean that, I'm not being sarcastic.) I still don't understand why Lawrence posed his question in the first pl

Re: Python script for searching variable strings between two constant strings

2016-08-26 Thread Steve D'Aprano
or re.match(FOO, line) or re.match(BAR, line) ) if mo: yield mo.groups(0) with open('mylogfile.log') as f: for match in extract(filter_sections(f)): print(match) By the way, the above code is untested. -- St

Re: What's the best way to minimize the need of run time checks?

2016-08-27 Thread Steve D'Aprano
ce that the author has missed the forest for all the trees, consider languages which actually do have only a single type: - in assembly language, everything is just bytes or words; - in Forth, similarly, everything is just a 16-bit or 32-bit word; - in Hypertalk, every value is stored interna

Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Steve D'Aprano
her type. Unless the type-checker was *really* smart, that would probably defeat the purpose. > Which way is it? Do you get errors, as per your example, and thus are > never allowed to have union types? And if so, what happens with > compatible types (notably, int and float)? Who says

Re: Is duck-typing misnamed?

2016-08-28 Thread Steve D'Aprano
, but equally we should not forget that when a moral panic is in full force, people behave absurdly, and the best antidote to absurd behaviour is to take the mickey out of it. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-29 Thread Steve D'Aprano
t so it wasn't bothering me any more." It freaks me out something wicked when I run a major GUI application like Firefox from the command line. Have you seen how many warnings and failed assertions it generates? It is scary. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Steve D'Aprano
e for something that isn't even a real rule. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Pythons for .Net

2016-09-03 Thread Steve D'Aprano
y contributor that prevents updating to MIT license. I have emailed him off-list. Thanks for the information on PythonNet, Denis. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Steve D'Aprano
ss the news->list gateway any more. > Killfile him and move on... But but but... I couldn't do that. https://www.xkcd.com/386/ -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: manually sorting images?

2016-09-04 Thread Steve D'Aprano
th a dog? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Steve D'Aprano
is not his or her real name. You owe Veek an apology, and a promise to the entire community that you will not act in such a bigoted, racist manner again. -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Why doesn't my finaliser run here?

2016-09-04 Thread Steve D'Aprano
xb7bf21ec> Traceback (most recent call last): File "", line 1, in File "", line 8, in __init__ Exception py> -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't my finaliser run here?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 10:37 pm, Ben Finney wrote: > Steve D'Aprano writes: > >> Why doesn't __del__ run here? > > Short anser: because nothing has removed the reference to the instance. Hmmm. You're probably right, but not for the reason you think :-) >>

Re: How to extend a tuple of tuples?

2016-09-09 Thread Steve D'Aprano
ple containing (5, 6) as the one and only item. Because that's a tuple with one item, you need a trailing comma: py> len( ((5, 6),) ) 1 py> a + ((5, 6),) ((1, 2), (3, 4), (5, 6)) -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-09 Thread Steve D'Aprano
tomer. So although there aren't many *great* alternatives to Gmail, there are some good and so-so alternatives: * run your own mail server (easy enough that I can do it) * your work or school email * your ISP email * Outlook.Com (Hotmail) -- Steve “Cheer up,” they said, “things cou

Re: PEP 492: isn't the "await" redundant?

2016-09-09 Thread Steve D'Aprano
e two distinct implementations of the same problem: how to run two or more chunks of code at the same time. In CPython we usually say "use threads for I/O bound tasks, processes for CPU bound tasks" but that's only because of the GIL. One doesn't need such a distinction in Jython or IronPyt

Re: PEP suggestion: Uniform way to indicate Python language version

2016-09-09 Thread Steve D'Aprano
n because it was a terrible idea. And 4.9 introduces unless expressions. I write this: x = spam |: eggs unless ValueError then cheese What syntax error should Python 4.0 give? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. --

Re: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-09 Thread Steve D'Aprano
plaintiff are, and whether the government of the day wants to defend or attack freedom of speech and/or privacy. Or even outright legal fraud, which is how we got corporations considered to be legal persons. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure e

Python source repo

2016-09-10 Thread Steve D'Aprano
3.6 beta just around the corner, there have been a LOT of changesets.) Is there some way to tell if hg is still processing or if it is locked up? I don't want to kill the process and have to go through the whole thing again if I don't have to. -- Steve “Cheer up,” they said, “things

Re: Python source repo

2016-09-10 Thread Steve D'Aprano
On Sun, 11 Sep 2016 01:04 am, Steve D'Aprano wrote: > I ran hg fetch to update the CPython repo. > > It has been stuck on "adding changesets" for half an hour. I don't know if > that's because the process has locked up, or because there really are that >

collect2: ld returned 1 exit status when building from source

2016-09-10 Thread Steve D'Aprano
I'm trying to build from source using: ./configure --with-pydebug && make -s -j2 At first the output is okay, then I get a whole heap of similar errors: Python/dtrace_stubs.o: In function `PyDTrace_LINE': /home/steve/python/python-dev/cpython/Include/pydtrace.h:25: mult

Re: collect2: ld returned 1 exit status when building from source

2016-09-10 Thread Steve D'Aprano
On Sun, 11 Sep 2016 03:34 am, Zachary Ware wrote: > On Sep 10, 2016 09:56, "Steve D'Aprano" > wrote: >> >> I'm trying to build from source using: >> >> ./configure --with-pydebug && make -s -j2 [...] >> Any suggestions for fixi

Re: collect2: ld returned 1 exit status when building from source

2016-09-10 Thread Steve D'Aprano
Touching Python/Python-ast.c but the build still fails, with the same errors: Python/dtrace_stubs.o: In function `PyDTrace_LINE': /home/steve/python/python-dev/cpython/Include/pydtrace.h:25: multiple definition of `PyDTrace_LINE' Python/ceval.o:/home/steve/python/python-dev/cpython/In

Re: Tkinter file dialog screwed

2016-09-13 Thread Steve D'Aprano
h KDE plasma 5. Any help? What happens if you change your KDE theme, or use another desktop environment? -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread Steve D'Aprano
On Wed, 14 Sep 2016 06:57 am, rgrigo...@gmail.com wrote: > It would help newbies and prevent confusion. No it wouldn't. Claims-which-are-made-without-evidence-can-be-rejected-without-evidence-ly y'rs, -- Steve -- https://mail.python.org/mailman/listinfo/python-list

<    3   4   5   6   7   8   9   10   11   12   >