A while ago I chose to use a deque that is shared between two threads. I did so
because the docs say:
"Deques support thread-safe, memory efficient appends and pops from either side
of the deque with approximately the same O(1) performance in either direction.”
I want to be able to apply different transformations to the first and last
elements of an arbitrary sized finite iterator in python3. It's a custom
iterator so does not have _reversed_. If the first and last elements are the
same (e.g. size 1), it should apply both transforms to the same
I guess this is kind of like mocking for testing. I have a simple module that's
imported in a number of other spots in my program. There's a condition in the
OS/filesystem where I'd like to import a polymorphically compatible variant of
the same module. Can this be accomplished in a sort of
> On Apr 23, 2021, at 05:55, Frank Millman wrote:
>
> On 2021-04-23 7:34 AM, Travis Griggs wrote:
>> Doing an "industry experience" talk to an incoming class at nearby
>> university tomorrow. Have a couple points where I might do some "fun things"
Doing an "industry experience" talk to an incoming class at nearby university
tomorrow. Have a couple points where I might do some "fun things" with python.
Said students have been learning some python3.
I'm soliciting any *fun* generators people may have seen or written? Not so
much the cool
> On Mar 30, 2021, at 12:11, Stestagg wrote:
>
> For completeness, from 3.5 onwards, you can also do the following:
>
> [{'name': n, **d} for n, d in dod.items()]
>
Reading through these, personally I like this one best. I'm curious what about
it was enabled in 3.5? Was **kwarg expansion
I've been looking into using a code formatter as a code base size has grown as
well as contributing developers. I've found and played with autopep, black, and
yapf. As well as whatever pycharm has (which may just be gui preferences around
one of those 3).
I have 2 questions:
1) Are there any
I’m using the cryptography module (https://cryptography.io/en/latest/) to try
and generate some cert/key/identities.
It's pretty easy using said module to generate the contents of .pem file for a
private key:
keyPEMBytes = privateKey.private_bytes(
Yesterday, I was pondering how to implement groupby, more in the vein of how
Kotlin, Swift, Objc, Smalltalk do it, where order doesn’t matter. For example:
def groupby(iterable, groupfunc):
result = defaultdict(list)
for each in iterable:
I have a directory structure that might look something like:
Data
Current
A
B
C
Previous
A
X
In as simple/quick a step as possible, I want to rename Current as Previous
including the contents and wiping out the
> On Apr 17, 2018, at 11:15 AM, MRAB <pyt...@mrabarnett.plus.com> wrote:
>
> On 2018-04-17 17:02, Travis Griggs wrote:
>> I posted this on SO, but… yeah…
>> I'm doing some serial protocol stuff and want to implement a basic byte
>> stuffing algorithm in pytho
I posted this on SO, but… yeah…
I'm doing some serial protocol stuff and want to implement a basic byte
stuffing algorithm in python. Though really what this really generalizes to is
“what is the most pythonic way to transform one sequence of bytes where some
bytes are passed through 1:1, but
> On Oct 25, 2016, at 5:55 AM, Chris Angelico wrote:
>
> On Tue, Oct 25, 2016 at 11:45 PM, Marko Rauhamaa wrote:
>> Chris Angelico :
>>
>>> On Tue, Oct 25, 2016 at 11:09 PM, Marko Rauhamaa wrote:
Blocking calls are
> On Sep 13, 2016, at 13:57, rgrigo...@gmail.com wrote:
>
> It would help newbies and prevent confusion.
for each in ['cake'] + ['eat', 'it'] * 2:
print(each)
--
https://mail.python.org/mailman/listinfo/python-list
> On Mar 30, 2016, at 2:36 PM, Gregory Ewing
> wrote:
>
> Tim Golden wrote:
>
>> (I don't know how other English-speaking groups say the word, but in
>> England the first syllable is stressed and the second is the
>> conventional short "uh" sound).
>
> I can
I wrote a simple set of python3 files for emulating a small set of mongodb
features on a 32 bit platform. I fired up PyCharm and put together a directory
that looked like:
minu/
client.py
database.py
collection.py
test_client.py
test_database.py
test_client.py
My
This may not be a great list for this question (which would be?); it’s a big
group, and I’m hoping there’s some people here that cross into these same areas.
I’m new to dbus, it seems it’s a sort of CORBA for the Linux world. :) Python
seems to be a popular way to interact with it. I’m trying
> On Jan 10, 2016, at 9:48 AM, Bernardo Sulzbach
> wrote:
>
> Essentially, classes (as modules) are used mainly for organizational purposes.
>
> Although you can solve any problem you would solve using classes
> without classes, solutions to some big problems may be
I should proof my posts before I send them, sorry
Subject nearly says it all.
If i’m using pathlib, what’s the simplest/idiomatic way to simply count how
many files are in a given directory?
I was surprised (at first) when
len(self.path.iterdir())
didn’t work.
I don’t see anything in the
Subject nearly says it all.
If i’m using pathlib, what’s the simplest/idiomatic way to simply count how
many files are in a given directory?
I was surprised (at first) when
len(self.path.iterdir())
I don’t say anything on the in the .stat() object that helps me.
I could of course do the
I was doing some maintenance now on a script of mine… I noticed that I compose
strings in this little 54 line file multipole times using the + operator. I was
prototyping at the time I wrote it and it was quick and easy. I don’t really
care for the way they read. Here’s 3 examples:
if k +
On Apr 7, 2015, at 8:42 AM, Hugo Caldas hcalda...@gmail.com wrote:
read and write the port values with multi threading
Care to elaborate what you mean by this part? In general, serial ports and
multi threading don’t mix well. IOW, you’ll need to use multithreading pieces
to make sure you
On Apr 4, 2015, at 4:43 PM, Damien George damien.p.geo...@gmail.com wrote:
Hello everyone,
We are pleased to announce the release of MicroPython version 1.4.1!
MicroPython is an implementation of Python 3.4 which is optimised for
systems with minimal resources, including
On Mar 24, 2015, at 8:28 PM, Chris Angelico ros...@gmail.com wrote:
On Wed, Mar 25, 2015 at 2:13 PM, otaksoftspamt...@gmail.com wrote:
I have a list containing 9600 integer elements - each integer is either 0 or
1.
Starting at the front of the list, I need to combine 8 list elements
On Mar 1, 2015, at 5:53 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
On Sun, 1 Mar 2015 20:16:26 + (UTC), alister
alister.nospam.w...@ntlworld.com declaimed the following:
The language is called English, the clue is in the name. interestingly
most 'Brits' can switch between
On Feb 24, 2015, at 9:47 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Pyston 0.3, the latest version of a new high-performance Python
implementation, has reached self-hosting sufficiency:
http://blog.pyston.org/2015/02/24/pyston-0-3-self-hosting-sufficiency/
On Feb 25, 2015, at 12:45 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
http://www.slideshare.net/pydanny/python-worst-practices
Any that should be added to this list? Any that be removed as not that bad?
I read ‘em. I thought they were pretty good, some more than others. And I
I really like pymongo. And I really like Python. But one thing my fingers
really get tired of typing is
someDoc[‘_’id’]
This just does not roll of the fingers well. Too many “reach for modifier keys”
in a row. I would rather use
someDoc._id
Googling shows that I’m not the first to want to do
On Feb 4, 2015, at 9:22 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Wed, Feb 4, 2015 at 9:50 AM, Travis Griggs travisgri...@gmail.com wrote:
I really like pymongo. And I really like Python. But one thing my fingers
really get tired of typing is
someDoc[‘_’id’]
This just does
On Feb 3, 2015, at 1:00 PM, Poul Riis prii...@gmail.com wrote:
I just tried the Cairo Python module.
I ran the test file below.
It works perfectly but instead of saving the resulting image as a file I want
to see it displayed directly on the screen.
How can I do that?
I have quiet a
On Feb 2, 2015, at 5:20 AM, Antoon Pardon antoon.par...@rece.vub.ac.be
wrote:
I need to have a program construct a number of designs. Of course I can
directly
use a pfd surface and later use a pdf viewer to check. But that becomes rather
cumbersome fast. But if I use a cairo-surface for
On Oct 23, 2014, at 2:11 PM, sohcahto...@gmail.com wrote:
On Thursday, October 23, 2014 10:07:26 AM UTC-7, jkn wrote:
Hi all
I haven't heard in mentioned here, but since I saw one of the boards
today thought I'd pass on the news:
The Kickstarter 'MicroPython' project, which has a
):
return Red()
Blue().toggle().toggle().toggle().toggle().toggle() :)
--
Travis Griggs
Objologist
Some of them wanted to sell me snake oil and I'm not necessarily going to
dismiss all of these, as I have never found a rusty snake. --Terry Pratchett
--
https://mail.python.org/mailman
Sent from my iPhone
On Oct 1, 2014, at 04:12, Peter Otten __pete...@web.de wrote:
`lambda` is just a fancy way to define a function inline
Not sure fancy is the correct adjective; more like syntactic tartness (a less
sweet version of syntactic sugar).
:)
--
Thanks all for the help/advice. I’m getting there.
To experiment/learn, I made a simple python program (/Foo/cyclic.py):
#!/usr/bin/env python3
import time
while True:
time.sleep(5)
with open('sound', 'r') as file:
currentValue = file.read()
On Sep 12, 2014, at 12:05 PM, Travis Griggs travisgri...@gmail.com wrote:
Thanks all for the help/advice. I’m getting there.
To experiment/learn, I made a simple python program (/Foo/cyclic.py):
#!/usr/bin/env python3
import time
while True:
time.sleep(5
On Sep 8, 2014, at 5:06 PM, Chris Angelico ros...@gmail.com wrote:
Alternatively, you could just run Debian Jessie. I have a few Jessie
systems on the network, with a Python 3.4 IIRC, and there've been no
stability problems lately. Both options are pretty easy.
In the end, we were able to get
I’ve been reading lots of systemd docs. And blogs. Etc. At this point, I think
I would benefit from learning by example…
Does anyone have an example .service file that they use to launch a long
running service written as a python program?
If there is any example of what you changed to your
On Sep 11, 2014, at 11:18 AM, Chris “Kwpolska” Warrick kwpol...@gmail.com
wrote:
Depends what you want.
Mine is not a web service. My main.py looks like this:
#!/usr/bin/env python3
import cycle
import pushTelemetry
from threading import Thread
def main():
On Sep 11, 2014, at 2:29 PM, Ervin Hegedüs airw...@gmail.com wrote:
Hi Travis,
On Thu, Sep 11, 2014 at 02:06:48PM -0700, Travis Griggs wrote:
On Sep 11, 2014, at 11:18 AM, Chris “Kwpolska” Warrick kwpol...@gmail.com
wrote:
Depends what you want.
Mine is not a web service. My
(I realize that this may be seen as off topic for as a general python question,
but given my historical experience with the Debian community’s predilection to
answer all questions with a grumpy “go read the very very very very large and
ever shifting fine manual”, I’m hoping for better luck
I have a python3 program that performs a long running service on a semi
embedded linux device. I've been in the prototyping stage. I just run it from
the command line and use print() statements to let me know the thing is making
acceptable process.
At some point, I need to properly daemonize
On Aug 21, 2014, at 12:55 AM, icefap...@gmail.com wrote:
Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic
(in a we-are-all-grown-ups fashion, ahem)enough to get its way into the
language
this is what yours truly thinks: don't we all know that : means the next
On Aug 4, 2014, at 22:57, Chris Angelico ros...@gmail.com wrote:
On Tue, Aug 5, 2014 at 3:47 PM, Satish ML satishmlwiz...@gmail.com wrote:
bytes = file.read()
You've just shadowed the built-in type 'bytes' with your own 'bytes'.
Pick a different name for this, and you'll be fine. 'data'
font. So the value of the along ed indent is lost
anyway. But wasn't that what spaces were supposed to give us over tabs, some
separation from the trading betwixt different editors? Chuckle.
Travis Griggs
--
https://mail.python.org/mailman/listinfo/python-list
On Jun 5, 2014, at 1:14, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote:
Swift's memory management is similar to python's (ref. counting). Which
makes me think that a subset of python with the same type safety would
be an instant success.
Except that while you don't need to regularly
On Jun 4, 2014, at 4:01 AM, Tim Chase python.l...@tim.thechases.com wrote:
If you use UTF-8 for everything
It seems to me, that increasingly other libraries (C, etc), use utf8 as the
preferred string interchange format. It’s universal, not prone to endian
issues, etc. So one *advantage* you
On May 28, 2014, at 3:43, Sameer Rathoud sameer.rath...@gmail.com wrote:
Hello everyone,
I am new to python.
I am currently using python 3.3
With python I got IDLE, but I am not very comfortable with this.
Please suggest, if we have any free ide for python development.
--
Sent from my iPhone
On May 24, 2014, at 7:35, blindanagram no...@nowhere.net wrote:
On 24/05/2014 08:13, wxjmfa...@gmail.com wrote:
Le vendredi 23 mai 2014 22:16:10 UTC+2, Mark Lawrence a écrit :
An article by Brett Cannon that I thought might be of interest
Python(3) let me down today. Better to be explicit, and all that, didn’t pan
out for me.
I have time series data being recorded in a mongo database (I love pymongo). I
have an iOS app that consumes the data. Since JSON doesn’t have a time format,
I have to stringify the times when transmitting
On Mar 15, 2014, at 14:24, Mark H Harris harrismh...@gmail.com wrote:
test
Pass
--
https://mail.python.org/mailman/listinfo/python-list
On Feb 23, 2014, at 17:09, Mark Lawrence breamore...@yahoo.co.uk wrote:
For the benefit of newbies, besides the obvious indentation error above, the
underscore basically acts as a dummy variable. I'll let the language lawyers
give a very detailed, precise description :)
You mean a
On Feb 21, 2014, at 6:32 AM, Roy Smith r...@panix.com wrote:
In article mailman.7230.1392992078.18130.python-l...@python.org,
Peter Otten __pete...@web.de wrote:
[x*x for (x,) in lst]
[paraphrasing...] can be better written as:
[x*x for [x] in items]
I'm torn between, Yes, the
On Feb 21, 2014, at 4:13 AM, Ned Batchelder n...@nedbatchelder.com wrote:
Man, do I hate this idea that Python has no variables. It has variables
(names associated with values, and the values can change over the course of
the program), they just don't work the same as C or Fortran
)
Travis Griggs
“Every institution tends to perish by an excess of its own basic principle.” —
Lord Acton
--
https://mail.python.org/mailman/listinfo/python-list
On Feb 10, 2014, at 10:30 PM, Steven D'Aprano st...@pearwood.info wrote:
1. Parenthesis should not be required for parameter- less functions.
Of course they should. Firstly, parameter-less functions are a code-
smell, and ought to be discouraged. Secondly, even if you have a good
On Feb 11, 2014, at 7:52 AM, Chris Angelico ros...@gmail.com wrote:
On Wed, Feb 12, 2014 at 2:36 AM, Travis Griggs travisgri...@gmail.com wrote:
OTOH, I’m not sure I’ve heard the parameters-less functions are a code one?
Is it just loose functions that you’re referring to? As opposed
The discussion about niladic functions, made me want to follow a segue and do
some reflection/introspective programming in Python. I’ve not done a lot of
that yet, and it seemed like an educational (well, at least entertaining) goose
chase.
If I run the following code:
import datetime
After the recent discussion about the classic error:
if self.isFooBar:
return 42
Among many thing, the OPs contention was that the ability to have this kind of
error was a Bad Thing (tm). Which led to me asking about code smells and
parameterless functions/methods.
So I got curious.
Looks like the 2/3 topic has lain fallow for a couple of days, gotta keep it
burning…
I’m a relatively recent python convert, but been coding and talking to others
about coding for many moons on this big blue orb. I think the industrial side
of this debate has been talked up quite a bit. We
On Jan 16, 2014, at 2:51 AM, Robin Becker ro...@reportlab.com wrote:
I assure you that I fully understand my ignorance of ...
Robin, don’t take this personally, I totally got what you meant.
At the same time, I got a real chuckle out of this line. That beats “army
intelligence” any day.
--
Here we go again…
On Jan 14, 2014, at 11:33 AM, Staszek nore...@eisenbits.com wrote:
Hi
What's the problem with Python 3.x? It was first released in 2008, but
web hosting companies still seem to offer Python 2.x rather.
For example, Google App Engine only offers Python 2.7.
What's
On Jan 15, 2014, at 4:50 AM, Robin Becker ro...@reportlab.com wrote:
On 15/01/2014 12:13, Ned Batchelder wrote:
On my utf8 based system
robin@everest ~:
$ cat ooo.py
if __name__=='__main__':
import sys
s='A̅B'
print('version_info=%s\nlen(%s)=%d' %
”, then… this approach might be appealing.
Travis Griggs
--
https://mail.python.org/mailman/listinfo/python-list
On Dec 20, 2013, at 8:00 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
A good point. Shall I write a PEP asking for a language change which
requires that that stupid = sign is replaced by a keyword reading something
like thenameonthelefthandsideisassignedtheobjectontherighthandside ?
Or
On Dec 11, 2013, at 5:31 AM, rusi rustompm...@gmail.com wrote:
The classic data structure for this is the trie:
General idea: http://en.wikipedia.org/wiki/Trie
In python:
http://stackoverflow.com/questions/11015320/how-to-create-a-trie-in-python/
My thoughts exactly!
If you wade through
On Dec 9, 2013, at 1:34 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
On 09/12/2013 05:07, ru...@yahoo.com wrote:
On 12/08/2013 05:27 PM, Mark Lawrence wrote:
On 09/12/2013 00:08, ru...@yahoo.com wrote:
On 12/08/2013 12:17 PM, Chris Angelico wrote:
On Mon, Dec 9, 2013 at 6:06 AM,
On Dec 5, 2013, at 2:56 AM, rusi rustompm...@gmail.com wrote:
3. https://groups.google.com/forum/#!forum/python-virtualenv may be a better
place to ask
Am I the only one that sees the irony in this suggestion? Given the long
running tirades^H^H^H^H^H^H thread about “Managing Google Groups
On Dec 4, 2013, at 6:52 AM, Rich Kulawiec r...@gsp.org wrote:
Yes, I'm
aware of web forums: I've used hundreds of them. They suck. They ALL
suck, they just all suck differently. I could spend the next several
thousand lines explaining why, but instead I'll just abbreviate: they
don't
On Dec 3, 2013, at 6:18 AM, Colin J. Williams c...@ncf.ca wrote:
On 03/12/2013 7:58 AM, Mark Lawrence wrote:
I thought this might be of interest
Http://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers
Is this intended to be better than the Raspberry PI?
Sent from my iPhone
On Nov 28, 2013, at 7:40, Michael Torrie torr...@gmail.com wrote:
On 11/28/2013 08:08 AM, Chris Angelico wrote:
Which is easier, fiddling around with your setup so you can post
reasonably on Google Groups, or just getting a better client? With
your setup, you have to
On Nov 27, 2013, at 3:32 AM, Dan Wissme wis...@hotmail.com wrote:
Hi !
Am I the only one to get a bug in GUIs using tkinter on my Mac under maverick
and Python 3.3.3 ?
When will they get rid of Tcl/Tk which causes recurrent problems at almost
each new Python version !
Please, for the
On Nov 20, 2013, at 6:01 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
On 20/11/2013 06:55, Travis Griggs wrote:
OSX (Mavericks) has python2.7 stock installed. But I do all my own
personal python stuff with 3.3. I just flushed my 3.3.2 install and
installed the new 3.3.3. So I need
On Nov 19, 2013, at 11:27 PM, Ned Deily n...@acm.org wrote:
In article 6856a21c-57e8-4cdd-a9e8-5dd738c36...@gmail.com,
Travis Griggs travisgri...@gmail.com wrote:
OSX (Mavericks) has python2.7 stock installed. But I do all my own personal
python stuff with 3.3. I just flushed my 3.3.2
OSX (Mavericks) has python2.7 stock installed. But I do all my own personal
python stuff with 3.3. I just flushed my 3.3.2 install and installed the new
3.3.3. So I need to install pyserial again. I can do it the way I've done it
before, which is:
Download pyserial from pypi
untar pyserial.tgz
to
share/ask for help with these kinds of things./aside
--Travis Griggs
I multiply all estimates by pi to account for running around in circles
--
https://mail.python.org/mailman/listinfo/python-list
of what
FEATURES/PACKAGES I could put there for consideration of omission. Is there
some magic juju that generates that?
Travis Griggs
--I multiply all estimates by tau to account for running around in circles
--
https://mail.python.org/mailman/listinfo/python-list
On Nov 4, 2013, at 9:22 AM, Travis Griggs travisgri...@gmail.com wrote:
I'm playing with a BeagleBone Black running the angstrom distro. Of course,
stock python is 2.7, I'd rather use python3. There isn't a python3 package
available for angstrom. So I downloaded the source and compiled
On Sep 23, 2013, at 8:06 AM, Chris Friesen cbf...@mail.usask.ca wrote:
Hi all,
I'm looking for a python IDE (for Linux) that can look at code like this:
class ConductorManager(manager.Manager):
def compute_recover(self, context, instance):
self.compute_api.stop(context,
('', line[::-1], '')
reversing = not line.endswith('+')
else:
print(line)
reversing = line.startswith('*')
Which begins reversing lines as its working through them, until a different
condition is met.
Travis Griggs
--
https
On Sep 16, 2013, at 4:33 PM, William Bryant gogobe...@gmail.com wrote:
Hey I am new to python so go easy, but I wanted to know how to make a program
that calculates the maen.
List = [15, 6, 6, 7, 8, 9, 40]
def mean():
global themean, thesum
for i in List:
thecount =
.
Travis Griggs
-- I multiple all estimates by pi to account from running around in circles.
--
https://mail.python.org/mailman/listinfo/python-list
(valveCount), byteStream.read(4
* valueCount)))
Thanks, both great ideas. Still does the read/decode slightly different between
the different sites, but at least it's localized better. Much appreciated.
--
Travis Griggs
History has a habit of changing the people who think they are changing
is preferred, we felt justified in marching on.
--
Travis Griggs
A vital ingredient of success is not knowing that what you're attempting can't
be done. -Terry Pratchett
--
http://mail.python.org/mailman/listinfo/python-list
is the
idea of an atEnd message for streams, it's inferred as a byproduct of a read().
Please be gentle/kind. I'm still learning. :) TIA
--
Travis Griggs
A vital ingredient of success is not knowing that what you're attempting can't
be done. -Terry Pratchett
--
http://mail.python.org/mailman
that could possibly work, but I'm assuming there's a more
pythonic way to approach this general problem.
TIA!
Travis Griggs
Simplicity is the ultimate sophistication. -- Leonardo Da Vinci
--
http://mail.python.org/mailman/listinfo/python-list
or data you can give me.
(I apologize if this is overtly naive).
--
Travis Griggs
Objologist
I did not have time to write you a short program, so I wrote you a long one
instead.
--
http://mail.python.org/mailman/listinfo/python-list
87 matches
Mail list logo