On Sun, Mar 20, 2016 at 8:44 PM, Ben Finney wrote:
> boB Stepp writes:
>> Can I not use:
>>
>> if rng is None:
>> rng = random.Random()
>
> That will work.
>
> It unfortunately creates a new random.Random instance every time that
> line is executed, making the function waste a lot of time.
boB Stepp writes:
> On Sun, Mar 20, 2016 at 8:19 PM, Ben Finney
> wrote:
> > if rng is None:
> > rng = random._inst
> >
> > which is the default RNG instance in the module.
>
> Can I not use:
>
> if rng is None:
> rng = random.Random()
That will work.
It unfortunately creates
On Sun, Mar 20, 2016 at 8:19 PM, Ben Finney wrote:
>
> Steven D'Aprano writes:
>
> > On Mon, Mar 21, 2016 at 12:18:01AM +1100, Ben Finney wrote:
> > > No, I meant what I wrote. The ‘rng’ parameter is expected to be
> > > bound to a RNG. If the caller has not specified a custom RNG
> > > instance,
Steven D'Aprano writes:
> On Mon, Mar 21, 2016 at 12:18:01AM +1100, Ben Finney wrote:
> > No, I meant what I wrote. The ‘rng’ parameter is expected to be
> > bound to a RNG. If the caller has not specified a custom RNG
> > instance, we bind ‘rng’ to the standard RNG instance found at
> > ‘random.
On Sun, Mar 20, 2016 at 07:57:55PM +, Albert-Jan Roskam wrote:
> > The intention is that repr() returns the "string representation" of the
> > object ("what does it look like?") while str() "converts this object to
> > a string". They are usually the same, but not always:
> >
> > py> from frac
> Date: Mon, 21 Mar 2016 02:50:17 +1100
> From: st...@pearwood.info
> To: tutor@python.org
> Subject: Re: [Tutor] __str__ vs. sys.displayhook
>
> On Sun, Mar 20, 2016 at 01:53:04PM +, Albert-Jan Roskam wrote:
>> Hi,
>>
>> The other day I was playing with
On Sun, Mar 20, 2016 at 01:53:04PM +, Albert-Jan Roskam wrote:
> Hi,
>
> The other day I was playing with this to make a convenient string version of
> a named tuple:
>
> >>> from collections import namedtuple as nt
> >>> Record = nt("Record", "x y z")
> >>> Record.__str__ = lambda self: "|
On Mon, Mar 21, 2016 at 12:18:01AM +1100, Ben Finney wrote:
> boB Stepp writes:
>
> > On Sat, Mar 19, 2016 at 8:03 AM, Steven D'Aprano
> > wrote:
> > > On Sat, Mar 19, 2016 at 04:05:58PM +1100, Ben Finney wrote:
> > >> if rng is None:
> > >> rng = random.random
> > >
> > > T
Hi,
The other day I was playing with this to make a convenient string version of a
named tuple:
>>> from collections import namedtuple as nt
>>> Record = nt("Record", "x y z")
>>> Record.__str__ = lambda self: "| %s |" % " | ".join([item + ": " +
>>> str(getattr(self, item)) for item in self._f
On 16 March 2016 at 13:21, Steven D'Aprano wrote:
> On Wed, Mar 16, 2016 at 08:36:59AM +, Matt Williams wrote:
>> Dear Tutors,
>>
>> I am looking for some advice. I have some data that has three dimensions to
>> it. I would like to store it such that one could manipulate (query/ update/
>> etc
boB Stepp writes:
> On Sat, Mar 19, 2016 at 8:03 AM, Steven D'Aprano wrote:
> > On Sat, Mar 19, 2016 at 04:05:58PM +1100, Ben Finney wrote:
> >> if rng is None:
> >> rng = random.random
> >
> > Typo: you want rng = random.randint.
No, I meant what I wrote. The ‘rng’ paramete
< snip lots of useful info >
Hi all,
Thanks a lot for all your replies. I am whole lot wiser now :)
Best wishes,
Albert-Jan
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription optio
Hi,
I got messages from a MCU by using codes below:
import socket
import time
port =
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind(("",port))
print('waiting on port:', port)
while True:
data, addr = s.recvfrom(1024)
print("DATA:", data, addr)
time.sleep(100)
The me
On Wednesday 16 March 2016 03:15 AM, Alan Gauld wrote:
On 15/03/16 21:31, Ken G. wrote:
Having acquired a new laptop yesterday with
Windows 10 installed and up-to-date, what
would be the best way to install the latest
version of Python 3?
Personally I always install ActiveState Python on
Windo
On Wed, Mar 16, 2016 at 12:56 PM, Alan Gauld wrote:
> On 16/03/16 12:46, CMG Thrissur wrote:
>
>> I tried to install activestate on win 10 but due to my ignorance or
>> lack of knowlege i could n't get to install pyqt or sip. i tried it
>> through pip.
PyQt can't be easily installed from source
Yeh wrote:
> Hi,
>
> I got messages from a MCU by using codes below:
>
> import socket
> import time
>
> port =
> s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
> s.bind(("",port))
> print('waiting on port:', port)
> while True:
> data, addr = s.recvfrom(1024)
> print("DATA:", data, a
16 matches
Mail list logo