DL Neil writes:
> On 11/25/2023 3:31 AM, Loris Bennett via Python-list wrote:
>> Hi,
>> I want to print some records from a database table where one of the
>> fields contains a JSON string which is read into a dict. I am doing
>> something like
>>
aking them accessible at the point where the object
wrapping the LDAP server is initialized?
I found this a suggestion here which involves creating a separate module for
the configuration and then importing it
https://codereview.stackexchange.com/questions/269550/python-share-global-variab
return s, n
--8<---cut here---end--->8---
--
https://mail.python.org/mailman/listinfo/python-list
def powers_of_2_in(n):
s = 0
while n % 2 == 0:
s += 1
n = n // 2
return s, n
> On 30 Nov 2023, at 02:44, Julieta Shem via Python-list
> wrote:
>
> How would you write this procedure?
>
> --8<---cut here---start---
On 2023-11-29 at 21:44:01 -0300,
Julieta Shem via Python-list wrote:
> How would you write this procedure?
>
> --8<---cut here---start->8---
> def powers_of_2_in(n):
> s = 0
> while "I still find factors of 2 in n...":
&g
Julieta Shem writes:
How would you write this procedure?
def powers_of_2_in(n):
...
def powers_of_2_in(n):
return (n ^ (n - 1)).bit_count() - 1
--
https://mail.python.org/mailman/listinfo/python-list
nted to
see if I could use the terminfo stuff directly to retain
use of regular input() and print() functions.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
d up with data hiding
and abstraction (also big topics back in the 70/80s)
So the term encapsulation has tended to be used to
cover abstraction and data hiding as well as simple(pure)
encapsulation.
> that is how python is designed. this is probably a complete
> aside to this whole thread a
g on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
You can let itertools.groupy find the groups.
max((len(tuple(group)), key) for key, group in itertools.groupby(s))
# (4, 'c')
--
https://mail.python.org/mailman/listinfo/python-list
importing
that and waiting as they all load.
-Original Message-
From: Python-list On
Behalf Of Ethan Furman
Sent: Thursday, January 14, 2021 2:36 PM
To: [email protected]
Subject: Re: why sqrt is not a built-in function?
On 1/14/21 11:06 AM, Eli the Bearded wrote:
> "There shoul
some sympathy for you. I am not sure that I can
give you a 100% satisfactory answer.
But:
if the math module should be automatically imported, how many other
modules that _somebody_ uses "all the time" should also be automatically
be imported? Python gives you a light-weight framework
my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
On 14/01/2021 23:08, Grant Edwards wrote:
> Alternatively, I think you can use the ncurses library to retrieve the control
> strings (just don't use any ncurses input/output calls), like this example
> from
> https://stackoverflow.com/questions/6199285/tput-cup-in-python-o
com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
On 14/01/2021 16:12, Alan Gauld via Python-list wrote:
> #
> import curses as cur
> cur.setupterm()
>
> bold = cur.tigetstr('bold')
> cls = cur.tigetstr('clear')
>
> cur.putp(cls)
> name = input("Hello, what's your name?
; printf("Enter a name: ");
>> fgets(line, sizeof(line),stdin);
>>
>> printf("Hello %s\n", line);
>> exit(0);
> One difference is that the name prompt is being written to stdout in
> the C version and stderr in the Python version. Bu
On 15/01/2021 21:41, Dennis Lee Bieber wrote:
> On Fri, 15 Jan 2021 13:19:26 +, Alan Gauld via Python-list
> declaimed the following:
>
>> So the native C functions work as expected.
>> Why does the Python wrapper not?
>
> Are you running Python from a p
On 17/01/2021 00:02, Greg Ewing wrote:
> On 17/01/21 12:40 pm, Chris Angelico wrote:
>> This is true. However, at some point, the boundary is crossed from
>> Python into the C library. Something, at that point, knows. It's very
>> common to have a flush option avail
On 18/01/2021 22:14, Random832 wrote:
> On Fri, Jan 15, 2021, at 13:36, Alan Gauld via Python-list wrote:
>> That could make a big difference, the putp() function specifically
>> states that it writes to stdout.
>
> I think there is a reasonable argument that this is a defici
On Sat, 16 Jan 2021 14:55:26 -0600, Logan Cranford wrote:
> I downloaded Python but when I try to run Idle it says it is not found
> and I should try to redownload it. When I try to do that all that comes
> up is a page that says modify, repair or uninstall. I have repaired
> several
On Sun, 17 Jan 2021 18:01:26 +, MRAB wrote:
> On 2021-01-17 13:57, Karsten Hilbert wrote:
>> Am Sun, Jan 17, 2021 at 02:20:24AM -0800 schrieb omid mohammadi:
>>
>>> When I open the sentinel-2 image in Python, I get the following error:
>>>
>>> Memor
On Sat, 16 Jan 2021 19:00:06 +0330, mohsen shooshtari wrote:
> hello,
> Thanks in advance for your consideration. I install python3.8 and then
> install Pycharm but when I call python in Command prompt, followed by (
> 'python'
> is not recognized as an internal or e
On Wed, 20 Jan 2021 08:33:40 -0700, Michael Torrie wrote:
> You can use escape characters in regular expression on any platform
> Python runs on. Python has a whole host of features to deal with the
> directory separator differences on Windows vs everybody else.
I am probably slightly
reinit() method.
I am not saying Python needs such a language change for generators as in
many programs you could just recreate a new instance of a generator. But
there may be places where by the time the generator is used, the original is
not known. Or, there are places where you want to lengthen
actly, but it shows as inspection on the bottom left
> corner.
>
> I believe it's indexing in the background.
>
> On Wed, Jan 27, 2021 at 3:25 PM Grant Edwards
>
> wrote:
>
> > On 2021-01-27, C W wrote:
> > > I'm not expert in Python, but I s
t:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
On 27/01/2021 19:27, Dietmar Schwertberger wrote:
> Python is an interactive language. You can develop a lot while working
> on a Python console. Then copy and paste into a program.
Absolutely, the humble interactive prompt is often overlooked
as a development tool. It's not as
however, remains your brain.
Amen to that, regardless of any software tool used.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
Hi
I'm new to Python and currently taking part in a Data Science course. Python is
the main coding/programming language for the course. We were guided to download
the Python application through Anaconda which worked. I have been using
Jupyther through a browser to practice Python exer
Dear Python-Team,
I have just repaired python after running my program which imports pyautogui,
closing and reopening it and then getting this: ModuleNotFoundError: No module
named „pyautogui“. Repairing didn’t work and I still get that message. All I
did was closing the perfectly working
On 27/01/2021 18:32, flaskee via Python-list wrote:
>
> While print() is groovy and all,
> if anyone runs across a non-pdb python debugger (standalone or IDE-based)
> please let me know.
>
There are many. But why must it be non-pdb? That seems rather arbitrary.
Or do you really
before too. But this is the
message I get.
And yes, i have checked, the input tag is the only tag with that class name, so
there isn´t another tag which selenium could´ve interacted with.
regards, me.
--
https://mail.python.org/mailman/listinfo/python-list
?
Can someone help me please? Thank you
--
https://mail.python.org/mailman/listinfo/python-list
uldphotos
--
https://mail.python.org/mailman/listinfo/python-list
Hello,
I’ve just typed „pip install selenium“ into my command prompt on windows 10.
Although my computer told me that the requirement was already satisfied, import
selenium did not work. So I tried different methods to install it and typed
„Python“ in my command prompt and imported selenium
g to read it using my personal CSV tools without specifying an
> encoding, it failed to understand the first column, hospital_pk. That is
> apparently because the file isn't simply ASCII or UTF-8. There are a few
> bytes ahead of the "h". However, if I open the file using
Hello,
Please note that this is not a kind of support service rather than a
community where people help each other on voluntary base.
In order to get help from here, you should provide enough information about
your issue with Python 3.9 that others can figure out what happened.
BR,
Roland
ke
ke 10. helmik. 2021 klo 5.07 Terry Reedy ([email protected]) kirjoitti:
> On 2/9/2021 9:55 AM, Philipp Daher via Python-list wrote:
> > Hello,
> >
> > I’ve just typed „pip install selenium“ into my command prompt on windows
> 10. Although my computer told me that the
other version before they do Python, or are they working on all of them
at once?
Realistically, many languages have chosen various paths and a model that
captures them all will have to be fairly complex and perhaps needlessly
complex. Does it need multiple ways to deal with issues like scope
On 11/02/2021 12:30, Mr Flibble wrote:
> I am starting work on creating a new Python implementation
> from scratch using "neos" my universal compiler that can
> compile any programming language.
Can i clarify that?
Are you saying that you are going to recompile the existin
.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
On 12/02/2021 21:46, Mr Flibble wrote:
> The neos Python implementation will consist of a schema file
> which describes the language plus any Python-specific semantic concepts
So the schema file is some kind of formal grammar definition of
the language?
And you "compile" th
On Fri, 12 Feb 2021 18:29:48 +, Tony Ogilvie wrote:
> I am trying to write a program to open a PostgesSQL 13 database using
> psycopg2. All seems to work if I write direct to Python but if I write
> the script into IDLE it does not work with the IDLE Shell 3.9.1
> reporting an
stored inside the object such as a
DELETE list and a MOVE list. You may also have lists with names like HIGH,
MEDIUM and LOW or priorities from 1 to N. I don't mean python lists, just
some kind of way of assigning some meaning to each item as you go. You may
even want a way to break a task
On 13/02/2021 16:09, Mr Flibble wrote:
> On 13/02/2021 00:01, Alan Gauld wrote:
>> I'm assuming it's a new executable interpreter that can run any
>> valid python code. Is that correct?
>
> It is a universal *compiler* so it compiles the python code to byte code
&
language after another (such as Ada or
Python) and create some kind of description that can be stored, such as in a
file. I have no idea what that might look like. I assume it would include what
keywords there are or what variable names might look like or if some construct
has an ending like "F
I don't have PSYCOPG2 on my system, but try doing the following from
python:
[mgogala@umajor ~]$ python3
Python 3.9.1 (default, Jan 20 2021, 00:00:00)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license&quo
On 14/02/2021 00:07, Mr Flibble wrote:
> On 13/02/2021 18:11, Alan Gauld wrote:
>> You are going to create a Python compiler that will take existing
>> Python code and output a byte code file.
>
> No neos is not a Python compiler: it is a *universal* compiler that
> can
bloat. In python, there are almost always many ways
to do anything!
So, I find it easier to develop in such languages BUT if the program is to be
run regularly and uses lots of resources and especially if it does not need
many of the dynamic features, there are ways to try to tune it within Python
On 15/02/2021 02:26, Avi Gross via Python-list wrote:
> I think we have discussed this a few times.
Indeed, many times!
And there is a natural tendency for a group focused on a
programming language to fixate on language improvements. But
it's worth while to back up and look at re
e/she tells.
Am I the only one who found it amusing, back to Python, that a recent attack
on Python was about a fairly trivial problem to solve in most languages, let
alone Python. Toy language does not normally apply to a fairly mature
language, regularly extended to do many things in many ways, u
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
Christian Gollwitzer writes:
> Am 16.02.21 um 06:36 schrieb dn:
>> Pascal's value as a teaching language was that it embodied many aspects
>> of structured programming, and like Python, consisted of a limited range
>> of items which could be learned very quickly (
On 16/02/2021 07:35, Christian Gollwitzer wrote:
> Am 16.02.21 um 06:36 schrieb dn:
>> Pascal's value as a teaching language was that it embodied many aspects
>> of structured programming, and like Python, consisted of a limited range
>> of items which could be lear
Christian,
Thanks for sharing. I took a look and he does have a few schemas for Ada and
C from TWO YEARS ago. Nothing about the infinite number of other languages
he plans on supporting, let alone Python. And what he has is likely not
enough to do what he claims he can do easily and rapidly
David Lowry-Duda writes:
>> In Norway, where I try to teach mathematics to highschoolers,
>> programming has recently entered the teaching of stem subjects.
>>
>> Even if Python is my choice language for personal projects, I am not
>> certain it is the right
ease write a BF program to compute the
> ackermann function. Should be easy, just three rules ;) I'd definitely
> choose Python to do it here.
>
> In that sense, Scheme also appears to be the Brainfuck of functional
> programming to me. It is not much more than the pure unty
I wonder if someone has come up with a sort of Python environment that lets
kids play with more fundamental parts of the language that lets them get
educated without the confusion. I mean a limited subset and with some
additions/modifications.
Someone mentioned how something like range(1,10
then.io/2014/01/01/how-tcp-backlog-works-in-linux.html
<http://veithen.io/2014/01/01/how-tcp-backlog-works-in-linux.html>
Humbly,
Karen
--
https://mail.python.org/mailman/listinfo/python-list
> On Feb 17, 2021, at 12:25 AM, Karen Shaeffer via Python-list
> wrote:
>
>
>
>> On Feb 16, 2021, at 8:10 PM, Jason Friedman wrote:
>>
>>>
>>> I set listen(2) and expect to see "error" when more clients than "the
>>> ma
On 16/02/2021 22:23, boB Stepp wrote:
>> And that's just one example, the language is now full of meta goodness
>> that makes it incomprehensible to beginners.
>
> Hmm. I'm not sure I can agree, Alan. My son took to Python 3 like a duck to
> water.
That
On 16/02/2021 21:22, Tarjei Bærland via Python-list wrote:
> To me, it depends on what you want out of including programming in
> mathematics education.
That's a really important subclass distinction.
If programming is seen as an adjunct to math then the aims
can be simplified conside
Dennis made the interesting comment "... Python has too much built in ..."
I understand his point. At the same time, I wonder what most people using
computers today, or in the future, need. Given serious amounts of computer
power, what many people may want is higher-level ways to get t
Hi,I am trying to install Scipy but it failed, I have python 3.9. I need
your assistance with that.
Thank you Mustafa Althabit8133825988
--
https://mail.python.org/mailman/listinfo/python-list
elphi for building windows
GUI apps today... But Delphi bears even less resemblance to
Wirth's Pascal, in fact its quite similar to Python in many
ways.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on F
On 19/02/2021 06:27, Smit Patel wrote:
> I recently downloaded python from your website and when I started using it,
> it worked correctly but when I installed the random2 module it showed
> startup failure and won't work again.
> So, I uninstalled it and downloaded it again but
Some of us here go way back and have stories to tell of what we did even
before Python existed. I won't rehash my history here now except to say I
did use PASCAL in graduate school and my first job before switching to C
which was less annoying to use.
What I am interested in, in this foru
plus or
minus depending.
(cons "A" (cons "v" (cons "I" nil)))
-----Original Message-
From: Python-list On
Behalf Of Benjamin Schollnick
Sent: Friday, February 19, 2021 1:31 PM
To: Michael F. Stemper
Cc: [email protected]
Subject: Re: New Python imple
photos
--
https://mail.python.org/mailman/listinfo/python-list
ED that some search
and research suggested other advanced methods they might use on the job
later, sure, maybe they get extra credit.
-Original Message-
From: Python-list On
Behalf Of Grant Edwards
Sent: Saturday, February 20, 2021 12:31 PM
To: [email protected]
Subject: Re: Is there
Mike,
You moved the goalpost.
Some of us here have been speculating you were asking what we call a
homework question here. The problem seemed to be the kind asked for that can
be done using fairly simple commands in python combined together.
Of course, some of the answers posted used ideas
advice or actual code that zoomed in one how to do it to a series. You clearly
saw it.
-Original Message-
From: Python-list On
Behalf Of Chris Angelico
Sent: Sunday, February 21, 2021 9:41 AM
Cc: Python
Subject: Re: Is there a way to subtract 3 from every digit of a number?
On Mon
Ah, that is an interesting, Mike, but not an informative answer. My
question is where the specific problem came from. Yes, someone used to R
and coming to Python might work at adjusting to what is different and how to
get things done. I do that all the time as one hobby is learning lots of
tp://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
. Unclicking
anything in this case may not be enough and perhaps the code should clear
all other items too. Clicking on any one, should mark all of them. So not
really a simple subset of the cases.
And what messages does a user get as they use the control?
-Original Message-
From: Python-list
just a category that could be doable.
-Original Message-----
From: Python-list On
Behalf Of Chris Angelico
Sent: Thursday, February 25, 2021 1:14 AM
To: Python
Subject: Re: name for a mutually inclusive relationship
On Thu, Feb 25, 2021 at 4:06 PM Avi Gross via Python-list
wrote:
>
> Is
n G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 25 Feb 2021 17:22:35 +, Botao Liu wrote:
> Dear Python team,
>
> This is my first time using Python, I tried to launch Python and it
> showed "Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC
> v.1928 64 bit (AMD64)] on win32 Type "help&qu
p://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
he right place.
--
Mladen Gogala
Database Consultant
https://dbwhisperer.wordpress.com
--
https://mail.python.org/mailman/listinfo/python-list
On 26/02/2021 22:23, Kevin M. Wilson via Python-list wrote:
> Hey Community, Is there a site where I might/can download a version of
> Tkinter for Python 2.7?
Which OS?
If it's Linux you may need to fetch the tkinter
package for your distro.
In Windoze it should come as s
https://mail.python.org/mailman/listinfo/python-list
On 28/02/2021 23:47, Alan Gauld via Python-list wrote:
> On 28/02/2021 00:17, Cameron Simpson wrote:
>
>> BUT... It also has a __iter__ value, which like any Box iterates over
>> the subboxes. For MDAT that is implemented like this:
>>
>> def __iter_
Hello,
this is windows setup issue related to the fact that python binary is not
in execution path.
For setting up you may find instructions by searching for "windows 10 put
python to path". One result is following page:
https://superuser.com/questions/143119/how-do-i-add-python-to-t
I can't work out why
1 + - 1
1 + (not 1)
are legal syntax, but
1 + not 1
isn't.
Is there a good reason for this?
Thanks
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list
" and just before
"and" and "or" so you need parentheses to force the interpretation you may
intend. Similarly, some used of "and" require parentheses as do other operators.
-Original Message-
From: Python-list On
Behalf Of Rob Cliffe via Python-list
how languages like Python and R grow and
how they keep adding features including many borrowed or imitated from
elsewhere and I conclude you can just put everything imaginable into Python
and the rest become superfluous! Problem solved.
-Original Message-
From: Python-list On
Behalf Of
etail that maybe
someone understanding it will give you a hint in advance.
-Original Message-----
From: Python-list On
Behalf Of sarang shah
Sent: Saturday, March 6, 2021 9:47 PM
To: [email protected]
Subject: Apriori Algorithm
I want to make apriori algorithm from start. Anybody have any
ning('warning from <%s>', __name__)
l.error('error from <%s>', __name__)
### baz.py
'''This only works if the importing module is named 'foo', which
precludes its use as a library module'''
import logging
l = logging.getLogger('foo.baz')
def func():
l.debug('debug from <%s>', __name__)
l.info('info from <%s>', __name__)
l.warning('warning from <%s>', __name__)
l.error('error from <%s>', __name__)
--
https://mail.python.org/mailman/listinfo/python-list
I apologize for my earlier snide remark as I was not then aware there was an
algorithm called apriori based on the Latin term and wondered if someone was
pulling someone's leg, in advance.
Someone has posted a pointer to Python code that is supposed to do that. If
that is suitable, the
precedence order such as "*" coming before "+" unless you use something like
parentheses to make your intent clear and over-ride it.
But it makes me think of a related question. Assume you are writing code in
a language like Python and the language has been analyzed and all kinds
before. Any
voluntary role here is generally to help with questions about fairly
specific python code as compared to big projects.
Good luck!
-Original Message-
From: Python-list On
Behalf Of sarang shah
Sent: Sunday, March 7, 2021 5:23 PM
To: [email protected]
Subject: Re: Apriori
ct you need to look in the ncurses documentation or
even the C code. And that is no guarantee that the Python
curses module will expose any values you do find other
than as numeric codes.
I would have expected the mouse wheel down/click to appear as
a BUTTON2 event to be honest. I didn't
le I
must import its logger, too, and decide how to deal with its messages.
> I hope that helps,
Much appreciated,
robert
--
https://mail.python.org/mailman/listinfo/python-list
gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
I have downloaded python 3.9.2 on my hp laptop with windows 10 and tried
opening both the normal python and the idle python on my pc but the norml keeps
opening the modify, repair and uninstall page while the idle keeps giving a
startup error. I have uninstalled, deleted and reinstalled
This is a valid Python program:
def f(): pass
print(f)
But at the REPL:
>>> def f(): pass
... print(f)
File "", line 2
print(f)
^
SyntaxError: invalid syntax
It doesn't seem to matter what the second line is. In the REPL you have
to leave a blank line af
On 11/03/2021 11:01, Rob Cliffe via Python-list wrote:
> This is a valid Python program:
>
> def f(): pass
> print(f)
>
> But at the REPL:
>
> >>> def f(): pass
> ... print(f)
> File "", line 2
> print(f)
> ^
> SyntaxErr
I have tried to startup my IDLE python severally but it keeps giving the
following message:
IDLE’s subprocess didn’t make connection. See the ‘Startup Failure’ section of
the IDLE doc online at
https://docs.python.org/3/library/idle.html#startup-failure.
I have gone to the page and followed
3401 - 3500 of 6649 matches
Mail list logo