Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Marko Rauhamaa writes: > Paul Rudin : > >> Marko Rauhamaa writes: >>> The object is only an intermediate result; what is returned is a >>> pointer (to an object), without an exception. That's not a matter of >>> implementation. It's an essent

Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Paul Rudin writes: > Marko Rauhamaa writes: >> So your "names" are *variables*. > > Informally yes, but "variable" has no meaning in the language reference. > ... err sorry, actually not correct - but irrelevant to the point under discussion. -- ht

Re: log file.

2016-06-14 Thread Paul Owen
I am very inexperienced at programming.! is there a lot of code needed to use those modules. regards paul. -- https://mail.python.org/mailman/listinfo/python-list

Re: log file.

2016-06-14 Thread Paul Owen
logging please. my pump programme works but I want to log the time etc. when the pump runs and stops. I am trying to improve the programme I am a novice! -- https://mail.python.org/mailman/listinfo/python-list

RE: log file.

2016-06-14 Thread Paul Owen
thanks I will look at them. -- https://mail.python.org/mailman/listinfo/python-list

RE: log file.

2016-06-14 Thread Paul Owen
Gmail Google+ Calendar Web more Inbox pump programme Paul Owen to me 1 hour ago Details from gpiozero import LED,Button from signal import pause print ("Pump Programme Running") led = LED(17) low = Button (2) high = Button (3) high.when_pressed = led.on  low.whe

Re: log file.

2016-06-14 Thread Paul Owen
Thank you Steven. that is just what I need. regards Paul. -- https://mail.python.org/mailman/listinfo/python-list

Re: log file.

2016-06-15 Thread Paul Rudin
Joaquin Alzola writes: > This email is confidential and may be subject to privilege. If you are > not the intended recipient, please do not copy or disclose its content > but contact the sender immediately upon receipt. Probably not a good idea to send it to a publicly accessible resource then :

(repost) Advisory: HTTP Header Injection in Python urllib

2016-06-17 Thread Paul Rubin
The blog post below is from a couple days ago: http://blog.blindspotsecurity.com/2016/06/advisory-http-header-injection-in.html It reports that it's possible to inject fake http headers into requests sent by urllib2(python2) and urllib(python3), by getting the library to retrieve a url concocted

Re: (repost) Advisory: HTTP Header Injection in Python urllib

2016-06-18 Thread Paul Rubin
Steven D'Aprano writes: >> The issue ... is cross-site request forgery. > Er, you may have missed that I'm talking about a single user setup. Are you > suggesting that I can't trust myself not to forge a request that goes to a > hostile site? I think the idea is you visit some website with malici

Re: Unexpected NANs in complex arithmetic

2016-06-21 Thread Paul Rubin
Steven D'Aprano writes: >> By the time Python returns a result for inf+3j, you're already in >> trouble (or perhaps Python is already in trouble). > I don't see why. It is possible to do perfectly sensible arithmetic on INFs. We sometimes think of the real line extended by +/- inf, or the complex

Re: Meta decorator with parameters, defined in explicit functions

2016-06-27 Thread Paul Rubin
Ben Finney writes: > decorator_with_args = lambda decorator: lambda *args, **kwargs: > lambda func: decorator(func, *args, **kwargs) > I would like to see a more Pythonic, more explicit and expressive > replacement with its component parts easily understood. How's this: from functools im

Re: Can math.atan2 return INF?

2016-06-30 Thread Paul Rubin
> Every time somebody tries to point to an example of a “topic that is > beyond the reach of science”, it seems to get knocked over eventually. Generate a sequence of "random" bits from your favorite physical source (radioactive decay, quantum entanglement, or whatever). Is the sequence really al

Re: Can math.atan2 return INF?

2016-06-30 Thread Paul Rubin
Lawrence D’Oliveiro writes: > The definition of “random” is “unknowable”. So all you are stating is > a tautology. What? No. You read a bunch of bits out of the device and you want to know whether they are Kolmogorov-random (you can look up what that means if you're not familiar with it). Quan

Re: Nested class doesn't see class scope

2016-07-04 Thread Paul Rubin
Steven D'Aprano writes: > ... class B: > ... x = var x = A.var -- https://mail.python.org/mailman/listinfo/python-list

Re: Touch screen development in Python

2016-07-11 Thread Paul Rubin
"Jahn" writes: > Does anyone use Python for developping applications that work with a > touch screen? I've done it on a system where the touch screen events were treated the same way as mouse events. Coding works out about the same way. -- https://mail.python.org/mailman/listinfo/python-list

Re: Were is a great place to Share your finished projects?

2016-07-13 Thread Paul Rubin
Michael Torrie writes: > So I can understand the allure of GitHub. It's shiny and free-ish. Savannah.nongnu.org is a nice free host for free software projects. I suppose it's less shiny than Github. On the other hand, Github is written in Ruby--what self-respecting Pythonista would stand for t

Re: math.frexp

2016-07-15 Thread Paul Rubin
Steven D'Aprano writes: > But this can give some protection against overflow of intermediate > values. Might be simplest to just add the logarithms. Look up Kahan summation for how to do that while minimizing loss of precision. -- https://mail.python.org/mailman/listinfo/python-list

Re: math.frexp

2016-07-16 Thread Paul Rubin
Steven D'Aprano writes: >>> protection against overflow of intermediate values. >> Might be simplest to just add the logarithms. > Simplest, but least accurate, even with Kahan summation or equivalent. Well the idea was to avoid overflow first, then hold on to whatever precision you have after th

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Paul Rubin
shrey.de...@gmail.com writes: > As a computer science undergraduate student, I don't want to spend > time writing the module but instead I want to work with it, play > around with it, and do problems with it. For educational purposes, I think writing the module yourself is part of the idea. Also,

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Paul Rubin
Chris Angelico writes: >> keep a reference to an element deep in the list, and insert a new >> element in O(1) time at that point. > at the C level, wouldn't tracing the links cost massively more than > the occasional insertion too? I'm not sure O(1) is of value at any > size, if the costs of all

Re: Stupid question, just need a quick and dirty fix

2016-07-21 Thread Paul Rubin
Jordan Bayless writes: > desired = Id < 10 or Id > 133 or Id in good_ids > When I try to validate whether I passed that check, I'm told there's a > Name error and it's not defined (using the last line of the snippet > above). Id was called IDNum in your earlier pst > Also, I guess I'm at a loss

Re: Why not allow empty code blocks?

2016-07-30 Thread Paul Rubin
Steven D'Aprano writes: >> Maybe. Lisp and Scheme are great languages to teach the theory.. > Doesn't sound like a good teaching language to me.> > Meta-reasoning is harder than regular reasoning. That's why metaclasses are > harder to use than ordinary classes. Python metaclasses are monstrousl

Re: Why not allow empty code blocks?

2016-07-31 Thread Paul Rubin
Gregory Ewing writes: > The reason Lisp is easier to program in than Forth is not > because of prefix vs. postfix. It's because in Lisp a function > call is syntactically grouped together with its arguments, > whereas in Forth it's not. Forth requires you to mentally > simulate the stack to figure

Re: Why not allow empty code blocks?

2016-07-31 Thread Paul Rubin
Marko Rauhamaa writes: > Gregory Ewing : >> If Forth had come out of a computer science department and Lisp had >> been invented by an astronomer, Lisp would still be the easier >> language to use. > > It is quite astounding how Lisp is steadily being reinvented by the > down-to-earth programming

Re: Why not allow empty code blocks?

2016-07-31 Thread Paul Rubin
Ian Kelly writes: > What does JSON have to do with LISP? JSON is a crappy form of S-expressions. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why not allow empty code blocks?

2016-07-31 Thread Paul Rubin
"D'Arcy J.M. Cain" writes: > So I have to examine every address I reply to or deal with the bounce > message later. Way to move your spam problem to someone else. It's not entirely about spam. I stopped posting addresses because people kept insisting on replying to my posts by email instead of

Re: Why not allow empty code blocks?

2016-07-31 Thread Paul Rubin
Steven D'Aprano writes: > There's a real mystery why concatenative/postfix languages have > received so little attention from the academic community compared to > prefix languages. There's a wiki with lots of info: http://www.concatenative.org This LTU thread and the article it links to is kind

Re: Why not allow empty code blocks?

2016-07-31 Thread Paul Rubin
Chris Angelico writes: > Yes, and we didn't have Python then. When I had a computer with 640KB > of memory, my options were (1) BASIC or (2) 8086 assembly language, > using DEBUG.EXE and its mini-assembler. Later on (much much later), I > added C to the available languages, but it was tedious and

Re: Why not allow empty code blocks?

2016-07-31 Thread Paul Rubin
Chris Angelico writes: > But out of 20MB, I easily had *space* for a compiler. The problem was > compilation time. I could mess around in BASIC with reasonable > turnaround times; I could mess around in DEBUG with excellent > turnaround times. Doing even the tiniest work in C meant delays long > e

Re: Can math.atan2 return INF?

2016-07-31 Thread Paul Rubin
Steven D'Aprano writes: > If Intuitionism influenced computer science, where is the evidence of this? > Where are the Intuitionist computer scientists? Pretty much all of them, I thought. E.g. programs in typed lambda calculus amount to intuitionistic proofs of the propositions given in the typ

Re: Why not allow empty code blocks?

2016-08-02 Thread Paul Rubin
Steven D'Aprano writes: > where power is defined (rather fuzzily) as the expressiveness > of the language, how easy it is for the programmer to read, write and > maintain code, how efficient/fast you can implement it, etc. Scheme guru Matthias Felleisen takes a stab at a precise definition here (

Re: Debugging (was Re: Why not allow empty code blocks?)

2016-08-02 Thread Paul Rubin
Terry Reedy writes: > I think it is you who is unwilling to admit that nearly everything > that would be useful also has a cost, and that the ultimate cost of > adding every useful feature, especially syntax features, would be to > make python less unusable. I think you meant "usable" ;). Some o

Re: Why not allow empty code blocks?

2016-08-03 Thread Paul Rubin
BartC writes: > sometimes you try to find a .py import module and it > doesn't seem to exist anywhere. (sys.py for example). > I would like to see how such references are translated to Lisp. (require 'sys) -- https://mail.python.org/mailman/listinfo/python-list

Why do data descriptors (e.g. properties) take priority over instance attributes?

2018-12-17 Thread Paul Baker
When Python looks up an attribute on an object (i.e. when it executes `o.a`), it uses an interesting priority order [1]. It looks for: 1. A class attribute that is a data-descriptor (most commonly a property) 2. An instance attribute 3. Any other class attribute We can confirm this using the c

Decoding a huge JSON file incrementally

2018-12-20 Thread Paul Moore
st as much as needed" in this way. Did I miss a trick? Or alternatively, is there a JSON decoder library on PyPI that supports this sort of usage? I'd rather not have to implement my own JSON parser if I can avoid it. Thanks, Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Decoding a huge JSON file incrementally

2018-12-20 Thread Paul Moore
On Thu, 20 Dec 2018 at 17:22, Chris Angelico wrote: > > On Fri, Dec 21, 2018 at 2:44 AM Paul Moore wrote: > > > > I'm looking for a way to incrementally decode a JSON file. I know this > > has come up before, and in general the problem is not soluble (because > &g

Re: Decoding a huge JSON file incrementally

2018-12-20 Thread Paul Moore
(Sorry, hit "Send" too soon on the last try!) On Thu, 20 Dec 2018 at 17:22, Chris Angelico wrote: > > On Fri, Dec 21, 2018 at 2:44 AM Paul Moore wrote: > > > > I'm looking for a way to incrementally decode a JSON file. I know this > > has come up be

Re: Question about slight deviations when using integer division with large integers.

2018-12-31 Thread Paul Moore
ns of signs of the 2 operands). Or maybe a function java_style_divide(), that your conventions mandate must be used in preference to // Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Transparently treating tar files and zip archives as directories

2019-01-06 Thread Paul Moore
Pyfilesystem (https://pypi.org/project/fs/) does something like this - it might be what you're after, Paul On Sun, 6 Jan 2019 at 22:32, Skip Montanaro wrote: > > I find it useful in some of the work I do to treat Zip archives as if > they were directories. I don't th

Re: Deletion of Environmental Variables

2019-01-06 Thread Paul Moore
On Mon, 7 Jan 2019 at 06:37, Terry Reedy wrote: > The pydev recommended way to run pip on windows is > > py -x.y pip > as this installs the package requested into the x.y site-packages > directory. py -3.7 -m pip ... Note the extra -m). Paul -- https://mail.python.org/m

Re: tkinter: variable width widgets in a grid?

2019-02-24 Thread Paul Sutton
are work in progress) here https://github.com/zleap/AboutMe hope this helps regards Paul -- https://mail.python.org/mailman/listinfo/python-list

Trying to read in data for a file to a python application

2019-02-26 Thread Paul Sutton
how to take that and insert the data in to the right places. Can anyone help please. Thanks Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Trying to read in data for a file to a python application

2019-02-26 Thread Paul Sutton
On 26/02/2019 15:51, Paul Sutton wrote: > Hi > > I have been trying to write a small application that is essentially user > information application. > > https://raw.githubusercontent.com/zleap/AboutMe/master/Aboutme.py > > So far I have managed to write the data generate

Re: dash/underscore on name of package uploaded on pypi

2019-02-28 Thread Paul Moore
is the normalised form of the name - see https://www.python.org/dev/peps/pep-0503/#normalized-names Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert Windows paths to Linux style paths

2019-03-12 Thread Paul Moore
sible that your answer to any or all of these questions are "I don't need to consider these cases". But we don't know which cases matter to you unless you clarify, and the *general* problem of "converting filenames" between operating systems is essentially impossible, because semantics are radically different. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert Windows paths to Linux style paths

2019-03-13 Thread Paul Moore
On Wed, 13 Mar 2019 at 08:13, eryk sun wrote: > > On 3/12/19, Paul Moore wrote: > > > > Do you care about case sensitivity (for example, is it important to you > > whether filenames "foo" and "FOO" map to the same file or not on > > Linux, give

Re: Question about the @staticmethod decorator

2019-03-17 Thread Paul Moore
ds you used, @staticmethod lets you organise your code in a certain way, but doesn't offer any extra capabilities over module-level functions. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: tkinter

2019-03-18 Thread Paul Sutton
ever 5 mins and say if this was successful or not. Not sure if you would ping as such, but if you can get a normal python script to do what you want, then you can add a gui later. hope this helps Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-27 Thread Paul Moore
documenting, adding to training materials, etc, etc? -1 on this. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-27 Thread Paul Moore
On Wed, 27 Mar 2019 at 12:27, Alexey Muranov wrote: > > On mer., mars 27, 2019 at 10:10 AM, Paul Moore > wrote: > > On Wed, 27 Mar 2019 at 08:25, Alexey Muranov > > wrote: > >> > >> Whey you need a simple function in Python, there is a choice > >

Library for parsing binary structures

2019-03-27 Thread Paul Moore
something specific to this problem. But I do keep hitting the need to parse binary structures, and having something in my toolbox for the future would be really nice. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Library for parsing binary structures

2019-03-28 Thread Paul Moore
very similar to how I'd approach that. My real interest is in whether any libraries exist to do this sort of thing (there are plenty of parser libraries for text, pyparsing being the obvious one, but far fewer for binary structures). Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Library for parsing binary structures

2019-03-29 Thread Paul Moore
is actually easy enough that hand crafting a parser isn't that much of a bother - maybe that's why there's less existing work in this area. Paul [1] The errors I'm reporting on are likely to be errors in my parsing code at this point, rather than errors in the data, but the problem is pretty much the same either way ;-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Library for parsing binary structures

2019-03-30 Thread Paul Moore
On Fri, 29 Mar 2019 at 23:21, Cameron Simpson wrote: > > On 27Mar2019 18:41, Paul Moore wrote: > >I'm looking for a library that lets me parse binary data structures. > >The stdlib struct module is fine for simple structures, but when it > >gets to more complicated

Re: fs package question - cp -p semantics when copying files?

2019-04-03 Thread Paul Moore
to copy_fs. Maybe you could use the getinfo/setinfo methods to copy over the timestamps and any other file metadata that you want in that callback? Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: fs package question - cp -p semantics when copying files?

2019-04-03 Thread Paul Moore
quot; to > particular values, but the docs are not clear on what the values are. > In particular, it seems the values have different structure for > different aspects of the overall set of attributes I want to modify. Yeah, the getinfo/setinfo stuff confused me too. But I thought

Re: pip unable to find an extension of a lib.

2019-04-12 Thread Paul Moore
d wheels that they provide aren't compatible. So if there's no compatible wheel and no source, there's nothing that can be installed. pip install -v pyqt5 might give you some more information about why the files available are not being considered as suitable, but I think the above is like

Re: pip as an importable module?

2019-05-01 Thread Paul Moore
o use that. The stuff here is probably what you want: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#getting-or-creating-distributions Paul On Wed, 1 May 2019 at 15:05, Skip Montanaro wrote: > > I'm trying to get pip-conflict-checker working with Python 3.6: &

Re: Change in cache tag in Python 3.8 - pip confused

2019-05-07 Thread Paul Moore
The RECORD file in that directory contains a list of all files installed when the package was originally installed (that's what pip uses to decide what to uninstall). Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Change in cache tag in Python 3.8 - pip confused

2019-05-07 Thread Paul Moore
f you're into recent packaging standards. For older pip versions, or projects not updated to recent standards, pip just says "hey, setuptools, install this stuff and tell me the names of all the files you created". Good luck digging into the setuptools/distutils code - take rations, torches and emergency flares, it's dangerous in there :-) Paul -- https://mail.python.org/mailman/listinfo/python-list

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

2019-05-08 Thread Paul Moore
;s O(number of live cells) rather than something that's O(maximum co-ordinate value ** 2). Paul -- https://mail.python.org/mailman/listinfo/python-list

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

2019-05-08 Thread Paul Moore
t being used). Disclaimer: I've only made very light use of golly, most of the above is inferred from the manual and reports of how others have used it. Paul On Wed, 8 May 2019 at 12:38, Richard Damon wrote: > > On 5/8/19 4:26 AM, Paul Moore wrote: > > On Wed, 8 May 2019 at 03:39,

Re: How to concatenate strings with iteration in a loop?

2019-05-21 Thread Paul Moore
minor performance note (not really important with only 10 items, but better to get into good habits from the start): temp = [f'{year},{mon},{day},{UTCHrs[k]:6.4f}'] for col in range(10): temp.append(f',{AExt[k, col]:9.7f}') tempStr = ''.join(tempStr) Repeated concatenation of immutable strings (which is what Python has) is O(N**2) in the number of chunks added because of the need to repeatedly copy the string. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Why Python has no equivalent of JDBC of Java?

2019-05-21 Thread Paul Moore
effort and have made the resulting libraries freely available. Who knows where we would be if Python had received a similar level of investment :-) Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: What does at 0x0402C7B0> mean?

2019-05-22 Thread Paul Moore
ter to stick with the simplest approach that does what you want, and statements like loops are simpler than complex one-line expressions (even if the complex one liners make you look cool ;-)) Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Implementing C++'s getch() in Python

2019-05-25 Thread Paul Moore
On Sat, 25 May 2019 at 12:12, wrote: > > I'm working on Python 3.7 under Windows. I need a way to input characters > without echoing them on screen, something that getch() did effectively in > C++. I read about the unicurses, ncurses and curses modules, which I was not > able to install using p

Re: installing of python

2019-06-17 Thread Paul Moore
ive the version number. (d) If you did a default install, Python is not added to your user PATH so you need to use the "py" launcher as I showed in (c) above. If you want Python adding to PATH, you need to specify that when installing (or manually add it to your PATH afterwards). Paul On

Re: For the code to generate `zen of python'.

2019-08-07 Thread Paul Moore
g encoded characters to their decoded equivalents. Decoding is done by adding 13 to the ASCII value of the letter (wrapping round from 25 back to 0). That's about it, really. Paul On Wed, 7 Aug 2019 at 14:17, Hongyi Zhao wrote: > > Hi here, > > I noticed that the `zen of pytho

Issue with Python installation

2019-09-11 Thread Manasiz Paul
Dear Sir/Madam, I have installed the latest version of Python but while running it, I am facing this issue continuously. [image: Untitled.png] Kindly let me know how to resolve this issue. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to get only valid python package index

2019-09-23 Thread Paul Moore
7;t take long if you read some articles to get a sense of some of the more well-known packages (things like requests, numpy, pandas, matplotlib, django, ...) but what is best for you depends entirely on what you are trying to do with Python. Hope this helps, Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: ypeError: decoding str is not supported

2019-09-28 Thread Paul Moore
x27;ve found, quick fixes tend to result in a cascade of further issues that *also* need quick fixes. The right solution here (and by far the cleanest one) is to review your code as a whole, and have a clear separation between bytes data and text data. The usual approach people use for this is to decode bytes into text as soon as it's read into your program, and only ever use genuine text data within your program - so you should only ever be using encode/decode in the I/O portion of your application, where it's pretty clear when you have encoded bytes coming in or going out. Hope this helps, Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Paul Moore
How does this compare to the existing appdirs module on PyPI? On Mon, 30 Sep 2019 at 13:15, Barry Scott wrote: > > See https://pypi.org/project/config-path/ for documentation. > > Install using pip: > > python -m pip install config-path > > I write tools that run on macOS, Unix and Window

Re: Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Paul Moore
On Mon, 30 Sep 2019 at 15:51, Barry Scott wrote: > > > On 30 Sep 2019, at 14:17, Paul Moore wrote: > > > > How does this compare to the existing appdirs module on PyPI? > > > > I did not know about appdirs. Fair enough ;-) > It does not seem to have separate

Re: Python 3.6 on Windows - does a python3 alias get created by installation?

2019-10-09 Thread Paul Moore
versioned executables is because that's how pip defines its entry points. It's cross-platform and unrelated to the conventions the Python core installers follow. Yes, it's all a bit confusing :-) Paul On Wed, 9 Oct 2019 at 17:37, Malcolm Greene wrote: > > I'm jumping betw

Re: Curious about library inclusion

2019-10-10 Thread Paul Moore
lot more than "this is a neat library". As another measure, look at various other libraries on PyPI and ask yourself why *this* library needs to be in the stdlib more than those others. The answer to that question would be a good start for an argument to include the library. Paul O

Re: Black

2019-10-21 Thread Paul Moore
es, I like some of your spacing choices, but not all of them. So we could have a debate over precisely which spaces I agree with and which I don't. But I'm not really interested in doing that. Black would probably help if we had to work together, but unless we do, you can do what you want

Re: installation problem

2019-10-24 Thread Paul Moore
, py.exe, which is on PATH and which will launch Python for you: * Run python: py * Run pip: py -m pip Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: keying by identity in dict and set

2019-10-28 Thread Paul Moore
ementation (and be prepared for it to change over time!) Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3 - How do I import a class from another file

2019-12-10 Thread Paul Moore
ll of hidden assumptions and unstated qualifications. And your attitude seems to be confrontational and aggressive. Frankly, it's unlikely that you're going to learn much without a change in your approach. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Relative import cannot find .so submodule?

2020-01-13 Thread Paul Moore
Did you build the extension as a debug build, but you're trying to use it in a release build Python? That may not work (it may depend on the OS, I don't know the compatibility details on MacOS)... On Mon, 13 Jan 2020 at 16:02, Pieter van Oostrum wrote: > > Patrick Stinson writes: > > > I have a

Re: Sandboxing eval() (was: Calculator)

2020-01-19 Thread Paul Moore
object with a few math functions. It works, but is it safe? If you trust the source, it's OK, but a creative attacker who had the ability to create a recipe could execute arbitrary code. If you require safety, you really need to write your own parser/evaluator. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Possible Addition to Python Language: Marked Sub-condition

2020-03-08 Thread Paul Moore
. Starting with a proposed language change before you've explored the existing options isn't likely to be the best approach (and would likely have meant you could resolve your issue without needing to bring it to python-ideas at all). Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: pip UX Studies - help improve the usability of pip

2020-03-09 Thread Paul Moore
We've had some questions as to whether this survey is legitimate. I can confirm it is (speaking as a pip core developer). The link to a page describing this work is https://pyfound.blogspot.com/2019/12/moss-czi-support-pip.html, if anyone wants to find out more. Paul Moore On Sat, 7 Mar 20

Re: [RELEASE] Python 3.9.0a6 is now available for testing

2020-04-29 Thread Paul Moore
at something isn't disambiguating this the same way as the 3.8 parser did (I'd say it's the "new parser" but Robin showed the same behaviour with "-X oldparser" which makes me wonder... Anyway, that's what I think is going on. I'll leave it to the p

Python extension module with callbacks into Python

2020-10-27 Thread Paul Grinberg
As full disclosure, I posted this question on StackOverflow as well, but it looks like questions with [Python] [Extension-Module] tags are not frequently answered. The link to my question there is https://stackoverflow.com/questions/64559322/python-extension-module-with-callbacks-into-python I

Re: Python extension module with callbacks into Python

2020-10-28 Thread Paul Grinberg
> > I am running into unpredictable behavior with my Python extension module > > that wraps around a C++ library that starts a new pthread and, after doing > > some work, generates callbacks back into the caller. I've greatly > > simplified this to a simplistic example which still demonstrates t

Re: Python extension module with callbacks into Python

2020-10-28 Thread Paul Grinberg
> Try calling PyEval_InitThreads() to force the python threading to be all > setup. Can you please clarify where/when I should call PyEval_InitThreads()? Is this in the main python thread before any pthread callbacks are generated? If so, should this be done only once? -- https://mail.python.

Re: Python extension module with callbacks into Python

2020-10-29 Thread Paul Grinberg
> > Can you please clarify where/when I should call PyEval_InitThreads()? Is > > this in the main python thread before any pthread callbacks are generated? > > If so, should this be done only once? > Do it in your module init. That function is safe to be called multiple time. > I decided to do

help(list[int]) → TypeError

2020-12-03 Thread Paul Bryan
Is this the correct behavior? Python 3.9.0 (default, Oct 7 2020, 23:09:01) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> help(list[int]) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/_sitebuiltins.py", line

list[type, type, ...] ?!

2020-12-03 Thread Paul Bryan
nse to me in Python 3.9: I can use the built-in generic alias in list in this manner, apparently successfully: >>> list[int, int] list[int, int] In fact, it appears I can specify an indeterminate number of types. Can someone explain what this construct means? I suspect this will fail to be interp

Re: list[type, type, ...] ?!

2020-12-03 Thread Paul Bryan
Thanks, Greg. Would it make sense for list's __class_getitem__ (GenericAlias?) to perform similar checking as typing._SpecialGenericAlias (nparams)? On Fri, 2020-12-04 at 12:15 +1300, Greg Ewing wrote: > On 3/12/20 7:37 pm, Paul Bryan wrote: > > > > > list[int, int] > &g

Re: help(list[int]) → TypeError

2020-12-04 Thread Paul Bryan
Thanks, will bring it to the dev list. On Fri, 2020-12-04 at 07:07 -0800, Julio Di Egidio wrote: > On Thursday, 3 December 2020 at 19:28:19 UTC+1, Paul Bryan wrote: > > Is this the correct behavior? > > > > Python 3.9.0 (default, Oct 7 2020, 23:09:01) > > [GCC 10.2.

Property type hints?

2020-12-08 Thread Paul Bryan
Would this be a reasonably correct way to annotate a property with a type hint? >>> class Foo: ... bar: int ... @property ... def bar(self): ... return 1 ... >>> foo = Foo() >>> import typing >>> typing.get_type_hints(foo) {'bar': } I could also decorate the property method r

Re: Property type hints?

2020-12-09 Thread Paul Bryan
Thanks for the comprehensive response, dn! I guess I'm influenced by data classes here, where the object's attribute type hints are represented by class variable annotations. On Thu, 2020-12-10 at 07:49 +1300, dn via Python-list wrote: > On 09/12/2020 13:17, Paul Bryan wrote: >

Re: Function returns old value

2020-12-11 Thread Paul Bryan
It won't return until the inner call to question (and it's not using the return value on inner call). Eventually, (and not until you answer yes) it will return the first answer. On Fri, 2020-12-11 at 18:55 -0700, Joe Pfeiffer wrote: > Bischoop writes: > > > I've function asking question and comp

Re: Function returns old value

2020-12-11 Thread Paul Bryan
Sorry, actually, if you do not answer yes, will always return None, not the first answer as I suggested. On Fri, 2020-12-11 at 18:55 -0700, Joe Pfeiffer wrote: > Bischoop writes: > > > I've function asking question and comparing it, if is not matching > > 'yes' > > it does call itself to ask que

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Paul Bryan
get("a", generate_a_default_value()) key='a' default=1 >>> The generate_a_default_value function was called before the call to get. It was called so it could produce a value that is actually passed in as an argument to the get function. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Paul Bryan
et returns the value of an > existing key. As am I. > What am I missing? You'll need to tell me at this point. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Paul Bryan
Maybe this will help: >>> def get(key, default): ... print("entering get") ... print(f"{key=} {default=}") ... print("exiting get") ... >>> def generate_default(): ... print("entering generate_default") ... print("exiting generate_default") ... return 1 ... >>> get("a", generate_defa

<    5   6   7   8   9   10   11   12   13   14   >