Re: Detect naming typos (AttributeError) in function names
Hello Dieter, thanks for your reply. Am 06.11.2023 19:11 schrieb Dieter Maurer: One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). Yes, that is the primary goal. But it is far away in the related project. I got a hint that "pylint" is able to detect problems like this. -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On Tue, 7 Nov 2023 12:11:18 +1300, Greg Ewing wrote: > On 6/11/23 6:34 pm, rbowman wrote: >> We've found even if you directly ask the user often the answer is 'I >> dunno' or some mythology they have constructed to explain the problem. > > This seems to apply to hardware issues as well. Louis Rossmann has a > philosophy of "Never believe what the customer tells you." Truer words... A customer called to report an industrial dielectric heater wasn't putting out full power. First question was 'Did you check the fuses?' since it was three phase but if you blew one leg it would still operate on reduced power. He assured me he had. I went through the rest of the common problems with no solution so the next day I flew out to the plant. I replaced the 30 amp fuse and all was good. The customer had a very expensive lesson in how to check fuses. At least with software you don't have to physically appear on site. -- https://mail.python.org/mailman/listinfo/python-list
RE: Checking if email is valid
Just mildly noticing the topics discussed have wandered quite a bit away from Python, let alone even programming. Phone numbers are not what they used to be. They tend to be quite portable and in some ways can be chained so my house phone rings through to my cell phone but a text will not be forwarded. And, if I do not choose to read my texts, no amount of sending would enlighten me about your needs. I know people who get WhatsApp messages but not standard texts, for example. -Original Message- From: Python-list On Behalf Of Chris Angelico via Python-list Sent: Monday, November 6, 2023 6:20 PM To: python-list@python.org Subject: Re: Checking if email is valid On Tue, 7 Nov 2023 at 10:11, Greg Ewing via Python-list wrote: > > On 7/11/23 7:45 am, Mats Wichmann wrote: > > Continuing with the example, if you have a single phone number field, or > > let a mobile number be entered in a field marked for landline, you will > > probably assume you can text to that number. > > But if the site can detect that you've entered a mobile number into > the landline field or vice versa and reject it, then it can figure out > whether it can text to a given numner or not without you having > to tell it! > Oh yes, it totally can. Never mind that some mobile numbers are able to accept text messages but not calls, nor that some landline numbers can accept text messages as well as calls :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On Tue, 7 Nov 2023 at 10:11, Greg Ewing via Python-list wrote: > > On 7/11/23 7:45 am, Mats Wichmann wrote: > > Continuing with the example, if you have a single phone number field, or > > let a mobile number be entered in a field marked for landline, you will > > probably assume you can text to that number. > > But if the site can detect that you've entered a mobile number into > the landline field or vice versa and reject it, then it can figure out > whether it can text to a given numner or not without you having > to tell it! > Oh yes, it totally can. Never mind that some mobile numbers are able to accept text messages but not calls, nor that some landline numbers can accept text messages as well as calls :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On 6/11/23 6:34 pm, rbowman wrote: We've found even if you directly ask the user often the answer is 'I dunno' or some mythology they have constructed to explain the problem. This seems to apply to hardware issues as well. Louis Rossmann has a philosophy of "Never believe what the customer tells you." -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On 7/11/23 7:45 am, Mats Wichmann wrote: Continuing with the example, if you have a single phone number field, or let a mobile number be entered in a field marked for landline, you will probably assume you can text to that number. But if the site can detect that you've entered a mobile number into the landline field or vice versa and reject it, then it can figure out whether it can text to a given numner or not without you having to tell it! -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: pip/pip3 confusion and keeping up to date
On 11/6/2023 5:04 PM, Karsten Hilbert via Python-list wrote: Am Mon, Nov 06, 2023 at 02:43:47PM -0700 schrieb Mats Wichmann via Python-list: I had just hoped someone here might have a handy pointer for how to deal with modules having to be installed from pip for use with an apt-installed python-based application. That just shouldn't happen - such packages are supposed to be dependency-complete within the packaging universe in question. Yep, that's the preferable ideal world. Which doesn't happen (but that's not the fault of anyone around here, no harm intended). .From all the posts I gather the answer to my question is "simply": unpackaged-but-needed modules need to be packaged. I think there is one aspect that isn't getting consideration here. And that is whether or not you want these packages installed in the default system Python install. You might not. Maybe you want to get the latest possible version of super-dooper-gui-helper, but one of its dependencies doesn't play well with the system Python libraries. Or ... but you get the point. There are probably many cases where you want *not* to install into the system Python world. So you would need to come up with an APT-based installer that doesn't do that. Obviously it's not unthinkable; it is just one more thing to figure out. -- https://mail.python.org/mailman/listinfo/python-list
Re: pip/pip3 confusion and keeping up to date
Am Mon, Nov 06, 2023 at 02:43:47PM -0700 schrieb Mats Wichmann via Python-list: > >I had just hoped someone here might have a handy pointer for > >how to deal with modules having to be installed from pip for > >use with an apt-installed python-based application. > > That just shouldn't happen - such packages are supposed to be > dependency-complete within > the packaging universe in question. Yep, that's the preferable ideal world. Which doesn't happen (but that's not the fault of anyone around here, no harm intended). .From all the posts I gather the answer to my question is "simply": unpackaged-but-needed modules need to be packaged. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list
Re: Help
On Sun, Nov 5, 2023 at 1:23 PM office officce via Python-list < python-list@python.org> wrote: > which python version is better to be used and how to make sure it works on > my window 10 because i downloaded it and it never worked so I uninstall to > do that again please can you give me the steps on how it will work perfectly > > If you are just starting out, the most recent version is 3.12 and is probably your best choice. When you say it never worked, can you describe in more detail what you did and what error messages you encountered? This mailing list does not accept screenshots. -- https://mail.python.org/mailman/listinfo/python-list
Re: pip/pip3 confusion and keeping up to date
On 11/6/23 14:28, Karsten Hilbert via Python-list wrote: I had just hoped someone here might have a handy pointer for how to deal with modules having to be installed from pip for use with an apt-installed python-based application. That just shouldn't happen - such packages are supposed to be dependency-complete within the packaging universe in question. -- https://mail.python.org/mailman/listinfo/python-list
Re: pip/pip3 confusion and keeping up to date
Am Mon, Nov 06, 2023 at 08:58:00AM +0100 schrieb Dieter Maurer: > I know that debian packagers create debian packages > from Python distributions not using the approach sketched above > and likely they have their reasons. > > You might want to discuss this on an `apt` related mailing list. Yeah, I guess. I know all this stuff about python modules being packaged for Debian and how apt handles dependencies etc etc. I had just hoped someone here might have a handy pointer for how to deal with modules having to be installed from pip for use with an apt-installed python-based application. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list
Re: pip/pip3 confusion and keeping up to date
Am Mon, Nov 06, 2023 at 01:17:11AM - schrieb Jon Ribbens via Python-list: > >> >> Are they not available in your system's package manager? > >> > > >> > ... this clearly often answers to "no" for applications of > >> > any complexity. > >> > > >> > Is there a suggested proper path to deal with that (Debian is > >> > of interest to me here) ? > >> > >> Yes, as previously mentioned, use virtual environments. > >> > > How does one "fill" that venv with packages from pip during > > > > apt-get install python3-app-of-interest > > > > ? > > > > Is the suggested way really to pip-install into this venv > > during apt-get install ? > > I don't know what you mean by that. But if you install the apt packages > and then create your venv with --system-site-packages then I believe > your venv should be able to see the apt packages and import them. The problem is when there's modules not available via apt as packages. In that case on needs to either package them or pip them into the venv suggested above. When they are apt-gettable no venv is needed in the first place. One would just install the application script like any other binary, and which loads apt-installed modules just so. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On Tue, 7 Nov 2023 at 07:10, Mats Wichmann via Python-list wrote: > Suggests maybe labeling should be something like: > > * Number you want to be called on > * Number for texted security messages, if different > > Never seen that, though :-) > My responses would be: * Don't. * That's what cryptographic keys are for. :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On 11/6/23 08:23, Jon Ribbens via Python-list wrote: On 2023-11-06, Mats Wichmann wrote: On 11/6/23 01:57, Simon Connah via Python-list wrote: The thing I truly hate is when you have two telephone number fields. One for landline and one for mobile. I mean who in hell has a landline these days? People who live in places with spotty, or no, mobile coverage. We do exist. Catering for people in minority situations is, of course, important. Catering for people in the majority situation is probably important too. A good experience would do both, in a comfortable way for either. Continuing with the example, if you have a single phone number field, or let a mobile number be entered in a field marked for landline, you will probably assume you can text to that number. I see this all the time on signups that are attempting to provide some sort of 2FA - I enter the landline number and the website tries to text a verification code to it (rather have an authenticator app for 2FA anyway, but that's a different argument) Suggests maybe labeling should be something like: * Number you want to be called on * Number for texted security messages, if different Never seen that, though :-) -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On Tue, 7 Nov 2023 at 02:05, Jon Ribbens via Python-list wrote: > That was another thing that I used to find ridiculous, but seems to have > improved somewhat in recent years - website error pages that said "please > contact us to let us know about this error". I'm sorry, what? You want > me to contact you to tell you about what your own website is doing? How > does that make any sense? Websites should be self-reporting problems. Actually, I think those serve a very important purpose. The reports are almost certainly being discarded unread; the value of such a reporting system is to give the user the sensation that they've "done something" to "help". It makes some people feel better about running into a bug. But you're right, they serve little purpose in solving web site problems. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Detect naming typos (AttributeError) in function names
Dieter Maurer via Python-list ezt írta (időpont: 2023. nov. 6., H, 19:13): > c.bu...@posteo.jp wrote at 2023-11-6 12:47 +: > >I would like to know how to detect (e.g. via a linter) typos in function > >names imported from another module. > > One option is a test suite (--> Python's "unittest" package) > with a sufficiently high coverage (near 100 %). > -- > https://mail.python.org/mailman/listinfo/python-list > Hi PyCharm IDE warns you, also vulture https://pypi.org/project/vulture/ finds dead code (not called / not used because of typo), and if you compile the code: https://docs.python.org/3/library/py_compile.html it will generate syntax error if non-existent function is called. linters can perhaps warn you (never had typos, because I use PyCharm) need to check the linters' doc BR, George -- https://mail.python.org/mailman/listinfo/python-list
Re: Detect naming typos (AttributeError) in function names
c.bu...@posteo.jp wrote at 2023-11-6 12:47 +: >I would like to know how to detect (e.g. via a linter) typos in function >names imported from another module. One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On 2023-11-06 08:57, Simon Connah via Python-list wrote: I can see how the truley dim-witted might forget that other countries have phone numbers with differing lengths and formatting/punctuation, but there are tons of sites where it takes multiple tries when entering even a bog-standard USA 10-0digit phone nubmer because they are completely flummuxed by an area code in parens or hyphens in the usual places (or lack of hyhpens in the usual places). This stuff isn't that hard, people... The thing I truly hate is when you have two telephone number fields. One for landline and one for mobile. I mean who in hell has a landline these days? And not accepting your mobile number in the landline number field is just when I give up. Or having a landline only field that does not accept mobile phones. I have a landline. It's also how I access the internet. -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On 2023-11-06, Mats Wichmann wrote: > On 11/6/23 01:57, Simon Connah via Python-list wrote: >> The thing I truly hate is when you have two telephone number fields. >> One for landline and one for mobile. I mean who in hell has a >> landline these days? > > People who live in places with spotty, or no, mobile coverage. We do > exist. Catering for people in minority situations is, of course, important. Catering for people in the majority situation is probably important too. -- https://mail.python.org/mailman/listinfo/python-list
Detect naming typos (AttributeError) in function names
Hello, I would like to know how to detect (e.g. via a linter) typos in function names imported from another module. Let's assume this given Python code snippet. import foo foo.baR() The package "foo" do contain a function named "bar()" (all lower case letters). The function "baR()" does not exist in "foo". This cause an AttributeError when run with a Python interpreter. The described error is not detected in my IDE (Emacs with eglot, pylsp and flake8) and not by flake8 on the shell. Because the involved tools do not look inside the "foo" package if "baR()" really exist. Can I fix this somehow? I am aware that this would get detected by a unit test. That is the way I do prefer in most cases. But sometimes not all code segments are covered by tests. I'm more interested in using a linter or something else for that. Kind Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On 2023-11-06, D'Arcy Cain wrote: > On 2023-11-05 06:48, Jon Ribbens via Python-list wrote: >> Sometimes I think that these sorts of stupid, wrong, validation are the >> fault of idiot managers. When it's apostrophes though I'm suspicious >> that it may be idiot programmers who don't know how to prevent SQL >> injection attacks without just saying "ban all apostrophes everywhere". >> Or perhaps it's idiot "security consultancies" who make it a tick-box >> requirement. > > https://xkcd.com/327/ Indeed. My point is that the correct way to solve this problem is not to declare vast swathes of valid inputs verboten, but to *not execute user input as code*. Controversial, I know. >>> OK, now that I am started, what else? Oh yah. Look at your credit >>> card. The number has spaces in it. Why do I have to remove them. If >>> you don't like them then you are a computer, just remove them. >> >> Yes, this is also very stupid and annoying. Does nobody who works for >> the companies making these sorts of websites ever use their own, or >> indeed anyone else's, website? > > Gotta wonder for sure. It could also be the case of programmers > depending on user input but the users insist on living with the bugs > and/or working around them. We made crash reporting dead simple to > report on and still users didn't bother. We would get the traceback and > have to guess what the user was doing. That was another thing that I used to find ridiculous, but seems to have improved somewhat in recent years - website error pages that said "please contact us to let us know about this error". I'm sorry, what? You want me to contact you to tell you about what your own website is doing? How does that make any sense? Websites should be self-reporting problems. (Not least because, as you say, people are absolutely terrible at reporting problems, with almost all bug reports reading effectively as "I was doing something that I'm not going to tell you and I as expecting something to happen which I'm not going to tell you, but instead something else happened, which I'm also not going to tell you".) -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On 11/6/23 01:57, Simon Connah via Python-list wrote: The thing I truly hate is when you have two telephone number fields. One for landline and one for mobile. I mean who in hell has a landline these days? People who live in places with spotty, or no, mobile coverage. We do exist. -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
On Sun, 5 Nov 2023 19:22:49 -0600, D'Arcy Cain wrote: > Gotta wonder for sure. It could also be the case of programmers > depending on user input but the users insist on living with the bugs > and/or working around them. We made crash reporting dead simple to > report on and still users didn't bother. We would get the traceback and > have to guess what the user was doing. We've found even if you directly ask the user often the answer is 'I dunno' or some mythology they have constructed to explain the problem. We had one site that reported if they hit the Enter key hard the query would work. It was a rather simple bug where the query would be randomly sent to the wrong interface. There is quite a bit of literature in psychology about intermittent reinforcement and the behavioral strategies that are developed. Works for rats, works for humans. -- https://mail.python.org/mailman/listinfo/python-list
Re: Checking if email is valid
> I can see how the truley dim-witted might forget that other countries > have phone numbers with differing lengths and formatting/punctuation, > but there are tons of sites where it takes multiple tries when > entering even a bog-standard USA 10-0digit phone nubmer because they > are completely flummuxed by an area code in parens or hyphens in the > usual places (or lack of hyhpens in the usual places). This stuff > isn't that hard, people... The thing I truly hate is when you have two telephone number fields. One for landline and one for mobile. I mean who in hell has a landline these days? And not accepting your mobile number in the landline number field is just when I give up. Or having a landline only field that does not accept mobile phones. Simon. signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list
Re: pip/pip3 confusion and keeping up to date
Karsten Hilbert wrote at 2023-11-5 23:19 +0100: > ... >do you happen to know where to read up on how to fit a pip >constraint file into a Debian package creation workflow ? I have only rudimentary `apt` knowledge. I know it is quite flexible, e.g. it used to handle `flash` in a special way. I expect it flexible enough to load from `PyPI`. `apt` is essentially controlled by a set of `sources`. Each "source" describes a list of package distributions. A description contains metadata about the distribution including name, version, description, dependencies, incompatibilities, etc. Any integration would require you to define one or more "source"s, listing the distributions which should come from `PyPI`. This would allow you to specify potential upgrades at a central place, the "source"s, you control. It would not solve the more fundamental problem: to determine which versions are compatible with the universe of (all the "sources" described) package versions. I know that debian packagers create debian packages from Python distributions not using the approach sketched above and likely they have their reasons. You might want to discuss this on an `apt` related mailing list. -- https://mail.python.org/mailman/listinfo/python-list