DL,
> I went through this cycle of thinking, first using if __name__... to
> 'hide' testing, then adding test functions within the module, and now keep
> test code quite separate from 'the real thing'.
:-) The normal newbie progression, off of which I'm in phase #1. Having a
working program
Python 3.8.1rc1 is the release candidate of the first maintenance release of
Python 3.8.
The Python 3.8 series is the newest feature release of the Python language, and
it contains many new features and optimizations. You can find Python 3.8.1rc1
here:
https://www.python.org/downloads/release/
On 10/12/19 9:45 pm, R.Wieser wrote:
In my case deleting the instance was needed to release its hold on something
that was taken when the instance was initialised (in my case a GPIO pin on a
Raspberry Pi). I did not even think of garbage collection.
In that case, it was only working by accid
I am running Python 2.7.10 on a Windows 10 machine. I have written a Python
program that counts occurrences of bytes in a text file and have run it on
a small test file. This file has CR-LF sequences at the ends of its lines.
The Python program counted the LF bytes, but didn't count any CR bytes.
G
Musbur wrote:
Hello,
I have a function with a long if/elif chain that sets a couple of
variables according to a bunch of test expressions, similar to function
branch1() below. I never liked that approach much because it is clumsy
and repetetive, and pylint thinks so as well. I've come up with
On Tue, Dec 10, 2019 at 9:17 PM Stephen Tucker wrote:
>
> I am running Python 2.7.10 on a Windows 10 machine. I have written a Python
> program that counts occurrences of bytes in a text file and have run it on
> a small test file. This file has CR-LF sequences at the ends of its lines.
> The Pyth
Greg,
> In that case, it was only working by accident.
I don't think so.
Or you must be thinking that the __del__ method of an instance is only
called by the garbage collector - which would be rather daft (just think of
a file thats created when initialising an instance, but not closes until t
On Tue, Dec 10, 2019 at 9:51 PM R.Wieser wrote:
>
> Greg,
>
> > In that case, it was only working by accident.
>
> I don't think so.
>
> Or you must be thinking that the __del__ method of an instance is only
> called by the garbage collector - which would be rather daft (just think of
> a file tha
I like it! I think it's a cute exercise but it doesn't really solve any
problem. The if/elif chain can accomplish the same thing (and much more)
in the same line count for the price of being clunkier. **D
--
https://mail.python.org/mailman/listinfo/python-list
Chris,
> Well, that's exactly what happens.
So, only the reference count gets lowered. Yep, thats daft.
... unless you explain why it can only be done that way.
> Also, when you scorn something without knowing your facts,
> you tend to make yourself look like a fool :)
I tend to go with logic
On Tue, Dec 10, 2019 at 11:46 PM R.Wieser wrote:
>
> Chris,
>
> > Well, that's exactly what happens.
>
> So, only the reference count gets lowered. Yep, thats daft.
>
> ... unless you explain why it can only be done that way.
Okay. What should happen when you do this?
x = 5
del x
Should the in
Sent from Mail for Windows 10
--
https://mail.python.org/mailman/listinfo/python-list
Musbur wrote:
I like it! I think it's a cute exercise but it doesn't really solve any
problem. The if/elif chain can accomplish the same thing (and much more)
in the same line count for the price of being clunkier. **D
Yep! This is why I wrote half a dozen of switch implementation but never
ac
i'm getting the error message while installing python in my dell laptop.
ERROR: the application was unable to start (0xc07b). Close the
application
Please help
--
https://mail.python.org/mailman/listinfo/python-list
Hello,
I have a new dell XPS, I freshly installed the latest version of
Pythong (3.8.0) and pycharm. Pycharm shows the site packages folder as red,
and I can not import and modules from inside of it. Pip install works to
install some programs like numpy, scipy, but would not install matplotlib
suc
Hello Neil,
thanks for the detailed answer.
Question: are there other people/factors who/which should be regarded
as more important than the linter's opinion?
Yes. Mine.
I was just puzzled at the linter's output (took me a while to figure out
what it actually meant), and that got me started
R.Wieser wrote:
Chris,
...
But, as you mentioned, I do not know (all) the facts. Please do present
them. Maybe there is a logic in there I do not yet see.
We may, but then you wrote:
Check out the 'with' statement.
I'm sorry, but nope.
Rule one: When debugging do *not* throw more stu
On Wed, Dec 11, 2019 at 12:26 AM Daniel Haude wrote:
> The whole thing is rather academic. Also my efficiency argument doesn't
> hold water because this routine is executed just a few times per hour. I
> like the "condition table" approach for its lower line count but I'll
> stick with if/elif bec
On 10/12/2019 03:35, Tim Daneliuk wrote:
On 12/9/19 8:50 PM, Paul Rubin wrote:
Tim Daneliuk writes:
- Imagine an environment in which there may be multiple instances of a given
microservice written in Python.
Decide the maximum number of microservice instances, say 1000. Chop up
the 10 d
Tim Daneliuk wrote:
> I ran across a kind of fun problem today that I wanted to run past you
> Gentle Geniuses (tm):
>
> - Imagine an environment in which there may be multiple instances of a
> given
> microservice written in Python.
>
> - Each of these services needs to produce a string of te
On 10/12/19 13:44, R.Wieser wrote:
> Chris,
>
>> Well, that's exactly what happens.
> So, only the reference count gets lowered. Yep, thats daft.
>
> ... unless you explain why it can only be done that way.
>
>> Also, when you scorn something without knowing your facts,
>> you tend to make yoursel
Hello Neil,
thanks for the detailed answer.
Question: are there other people/factors who/which should be regarded
as more important than the linter's opinion?
Yes. Mine.
I was just puzzled at the linter's output (took me a while to figure out
what it actually meant), and that got me started
Chris Angelico wrote:
> On Tue, Dec 10, 2019 at 12:15 PM songbird wrote:
>>
>> Chris Angelico wrote:
>> ...
>> >
>> > Here's an example piece of code.
>> >
>> > sock = socket.socket(...)
>> > name = input("Enter your username: ")
>> > code = input("Enter the base64 code: ")
>> > code = base64.b64d
Chris Angelico wrote:
> On Tue, Dec 10, 2019 at 4:41 PM songbird wrote:
>>
>> Chris Angelico wrote:
>> ...
>> > What if neither works, because there are assumptions that don't work?
>>
>> then you get stuck doing it by hand, but you would have
>> been stuck doing it before for sure by hand so if
On Wed, Dec 11, 2019 at 1:53 AM Antoon Pardon wrote:
> What would you want to happen in the following case:
>
>foo1 = Bar()
>foo2 = foo1
>del foo1
>
> Should the object be cleaned up now or not?
>
TBH both are plausible, and to a Python programmer it's immediately
obvious that "foo1.c
On Wed, Dec 11, 2019 at 1:57 AM songbird wrote:
>
> Chris Angelico wrote:
> > On Tue, Dec 10, 2019 at 12:15 PM songbird wrote:
> >>
> >> Chris Angelico wrote:
> >> ...
> >> >
> >> > Here's an example piece of code.
> >> >
> >> > sock = socket.socket(...)
> >> > name = input("Enter your username:
Chris,
Many thanks. The first part of your answer was spot on. I have modified the
program, opening its input file in "rb" mode, and now the program is
working as I intend it to.
I am puzzled by the second part, where you say that the read call will
return one character, if the file is in text mo
On 10/12/19 16:10, Chris Angelico wrote:
> On Wed, Dec 11, 2019 at 1:53 AM Antoon Pardon wrote:
>> What would you want to happen in the following case:
>>
>>foo1 = Bar()
>>foo2 = foo1
>>del foo1
>>
>> Should the object be cleaned up now or not?
>>
> TBH both are plausible,
I find that
On Wed, Dec 11, 2019 at 2:18 AM Stephen Tucker wrote:
>
> Chris,
>
> Many thanks. The first part of your answer was spot on. I have modified the
> program, opening its input file in "rb" mode, and now the program is working
> as I intend it to.
>
Cool!
> I am puzzled by the second part, where
On Wed, Dec 11, 2019 at 2:36 AM Antoon Pardon wrote:
>
> On 10/12/19 16:10, Chris Angelico wrote:
> > On Wed, Dec 11, 2019 at 1:53 AM Antoon Pardon wrote:
> >> What would you want to happen in the following case:
> >>
> >>foo1 = Bar()
> >>foo2 = foo1
> >>del foo1
> >>
> >> Should the
On 10/12/19 16:56, Chris Angelico wrote:
> On Wed, Dec 11, 2019 at 2:36 AM Antoon Pardon wrote:
>> On 10/12/19 16:10, Chris Angelico wrote:
>>> On Wed, Dec 11, 2019 at 1:53 AM Antoon Pardon wrote:
What would you want to happen in the following case:
foo1 = Bar()
foo2 = f
On Mon, 9 Dec 2019 21:38:43 -0600, Tim Daneliuk wrote:
> On 12/9/19 8:54 PM, Dennis Lee Bieber wrote:
>> On Mon, 9 Dec 2019 18:52:11 -0600, Tim Daneliuk
>> declaimed the following:
>>
>>> - Each of these services needs to produce a string of ten digits
>>> guaranteed to be unique on a per servic
On 12/10/19 5:44 AM, R.Wieser wrote:
>> Well, that's exactly what happens.
>
> So, only the reference count gets lowered. Yep, thats daft.
Why? Consider:
a = someobject
b = a
How many references for someobject? After "del a" what should be be?
It's still someobject (the same object).
Or the
i'm getting the error message while installing python in my dell laptop.
ERROR: the application was unable to start (0xc07b).
The error code 0xc07b means STATUS_INVALID_IMAGE_FORMAT, i.e. probably that
the program you want to start is not made for the processor architecture of
your com
Python,
> which contradicts your previous statement.
I don't think so.
> "with" is "more stuff" it is the right way to deal with disposable
> ressource in the first place.
Than you have missed the point altogether. It isn't about what you think is
the perfect way to deal with something, but
Chris,
> Okay. What should happen when you do this?
>
> x = 5
> del x
>
> Should the integer 5 be deleted?
Yep.
What do you think happens instead ? I've not seen you explain or support
anything in that regard, not even now.
There is a bit of a problem with the above though: It has got zero t
Antoon,
> Well yes that is why it is stupid to rely on the garbage collector to do
> those things for you. That is why Greg Ewing already stated:
>
>> If your object has a method for explicitly making it release its
>> resources, it would be better to use that rather than rely on
>> the garbage co
On 12/10/19 10:36 AM, Peter Pearson wrote:
> Just to be sure: you *are* aware that the "Birthday Paradox" says
> that if you pick your 10-digit strings truly randomly, you'll probably
> get a collision by the time of your 10**5th string . . . right?
I did not consider this, but the point is taken.
On 2019-12-10 17:18, R.Wieser wrote:
Chris,
Okay. What should happen when you do this?
x = 5
del x
Should the integer 5 be deleted?
Yep.
What do you think happens instead ? I've not seen you explain or support
anything in that regard, not even now.
There is a bit of a problem with the a
On Wed, Dec 11, 2019 at 5:01 AM Tim Daneliuk wrote:
>
> On 12/10/19 10:36 AM, Peter Pearson wrote:
> > Just to be sure: you *are* aware that the "Birthday Paradox" says
> > that if you pick your 10-digit strings truly randomly, you'll probably
> > get a collision by the time of your 10**5th string
On 10/12/2019 17:18, R.Wieser wrote:
Chris,
Okay. What should happen when you do this?
x = 5
del x
Should the integer 5 be deleted?
Yep.
What do you think happens instead ? I've not seen you explain or support
anything in that regard, not even now.
As it happens, the object that is the
Michael,
>> So, only the reference count gets lowered. Yep, thats daft.
>
> Why? Consider:
You missed the point.
It was-and-is not about decrementing a reference but still having it above
zero, but what happens when the reference becomes zero: is the __del__
method called directly (as I find
On Wed, Dec 11, 2019 at 5:51 AM R.Wieser wrote:
>
> Michael,
>
> >> So, only the reference count gets lowered. Yep, thats daft.
> >
> > Why? Consider:
>
> You missed the point.
>
> It was-and-is not about decrementing a reference but still having it above
> zero, but what happens when the refere
MRAB,
> You merely disabled the mark-and-sweep collector.
Nope. Go check the docs on "gc"
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Dec 11, 2019 at 6:06 AM R.Wieser wrote:
>
> MRAB,
>
> > You merely disabled the mark-and-sweep collector.
>
> Nope. Go check the docs on "gc"
>
https://docs.python.org/3/library/gc.html
"""
This module provides an interface to the optional garbage collector.
... Since the collector sup
On 10/12/2019 19:00, R.Wieser wrote:
MRAB,
You merely disabled the mark-and-sweep collector.
Nope. Go check the docs on "gc"
Yep. Go and check the docs on "gc" *carefully*
*plonk*
--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list
R.Wieser schreef op 10/12/2019 om 13:44:
Also, when you scorn something without knowing your facts,
you tend to make yourself look like a fool :)
I tend to go with logic. No logic => it most likely doesn't work that way.
Choosing to go with a delayed action like you say will, as I already
e
Rhodri,
> the object that is the integer 5 *isn't* deleted
That was not the question. And you're now referring to the object as well
as the integer, which makes it confusing. You also have not explained what
happens instead. In short, your above statement has ZERO value to me.
> On the cont
On 2019-12-10 19:25, R.Wieser wrote:
Rhodri,
the object that is the integer 5 *isn't* deleted
That was not the question. And you're now referring to the object as well
as the integer, which makes it confusing. You also have not explained what
happens instead. In short, your above statement
On 10/12/2019 19:25, R.Wieser wrote:
And to repeat, you have*no* guarantee*at all* in the language spec that
this will happen.
There is also absolutily no guarantee in those specs that my 'puter will not
suddenly transform into a bonzai tree. Should I now expect it to happen ?
That's an im
Dennis,
> In common Python, small integers are cached internally for reuse
That is what I imagined could possibly be happening, reading the specific
"the integer 5" formulation in the question ("reading between the lines" and
all that).
And thanks for that explanation, underbuild an all. :-)
Chris,
> Once again, you make positive assertions about things you
> don't understand.
And you have refused to bring any kind of help (explanation!) forward that
could have shown me the erring of my ways, as well as refusing to adress my
(attempting to explain) examples.
You might know a thing o
Roel,
> Rudy, unless/until you know the language inside out, you'd better listen
> to Chris and other people here who spend a lot of time and effort in
> helping people like you.
I tried. But what he said made no sense to me, and no matter how hard I
tried I could not get Chris (or others fo
On Wed, Dec 11, 2019 at 8:26 AM R.Wieser wrote:
>
> Roel,
>
> > Rudy, unless/until you know the language inside out, you'd better listen
> > to Chris and other people here who spend a lot of time and effort in
> > helping people like you.
>
> I tried. But what he said made no sense to me, and no
On Tue, 10 Dec 2019 at 21:12, R.Wieser wrote:
> And although you have been fighting me over when the __del__ method is
> called, it /is/ called directly as a result of an "del instance" and the
> refcount goes zero. There is /no/ delay.(with the only exception is
> when a circular reference e
On 2019-12-10 21:08, R.Wieser wrote:
Chris,
Once again, you make positive assertions about things you
don't understand.
And you have refused to bring any kind of help (explanation!) forward that
could have shown me the erring of my ways, as well as refusing to adress my
(attempting to explain
On 12/10/19 11:47 AM, R.Wieser wrote:
> Who did I call stupid ?I mentioned that the language doing it as Chris
> thinks it happens would be stupid, and I gave a reason for that (race
> conditions everywhere). But odd: Neither him nor you nor anyone else who
> complains about me thinking for
On 12/10/19 2:08 PM, R.Wieser wrote:
> You might know a thing or two about Python, but you (and a number of others
> here) positivily stink as teachers, incapable or even unwilling to place
> themselves in the shoes of a newbie.
As it happens, I've heard Chris speak about teaching Python to studen
Michael Torrie wrote:
On 12/10/19 2:08 PM, R.Wieser wrote:
You might know a thing or two about Python, but you (and a number of others
here) positivily stink as teachers, incapable or even unwilling to place
themselves in the shoes of a newbie.
As it happens, I've heard Chris speak about teach
Hi all
It took me a while to track down a bug that stemmed from this -
>>> from datetime import date as dt, time as tm, datetime as dtm
>>> x = dt.today()
>>> isinstance(x, dt)
True
>>> isinstance(x, dtm)
False
>>> y = dtm.now()
>>> isinstance(y, dt)
True <--- ??
>>> isinstance
60 matches
Mail list logo