his seems like "the
quickest thing 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
ignatures).
]
The part that doesn't seem to be there in the standard python library 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 k
t.unpack('>{}I'.format(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 th
nt that
"internal consistency 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
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 element
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.”
(https://docs.python.org/3.11/lib
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 ma
> 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 in
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 o
> 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"
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 once
> 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 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 evil.
>>>
>>> Oh, that's why. Got it. So because blocking calls are fund
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 Apr 17, 2018, at 11:15 AM, MRAB 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 python. Though really what this re
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 or
> 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 attest that New Zealand follows th
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:
result[groupfunc(each)].ap
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(
encoding=serialization.Encoding.P
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
On Nov 20, 2013, at 6:01 AM, Mark Lawrence 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 nee
On Nov 19, 2013, at 11:27 PM, Ned Deily wrote:
> In article <6856a21c-57e8-4cdd-a9e8-5dd738c36...@gmail.com>,
> 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.
On Nov 27, 2013, at 3:32 AM, Dan Wissme 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 rest of us...
I
Sent from my iPhone
> On Nov 28, 2013, at 7:40, Michael Torrie 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 drop out
On Dec 3, 2013, at 6:18 AM, Colin J. Williams 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? RPi
On Dec 4, 2013, at 6:52 AM, Rich Kulawiec 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 handle thre
On Dec 5, 2013, at 2:56 AM, rusi 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 headaches”?
“Pleasss
On Dec 9, 2013, at 1:34 AM, Mark Lawrence 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, wrote:>[...]
>
On Dec 11, 2013, at 5:31 AM, rusi 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 the comments ther
On Dec 20, 2013, at 8:00 AM, Mark Lawrence 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 a symbol like :=. As
ute said list”, then… this approach might be appealing.
Travis Griggs
--
https://mail.python.org/mailman/listinfo/python-list
Here we go again…
On Jan 14, 2014, at 11:33 AM, Staszek 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 wrong?...
Maybe
On Jan 15, 2014, at 4:50 AM, Robin Becker 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' % (s
On Jan 16, 2014, at 2:51 AM, Robin Becker 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.
--
https://mail.
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 ha
On Feb 10, 2014, at 10:30 PM, Steven D'Aprano 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
> reason for usin
On Feb 11, 2014, at 7:52 AM, Chris Angelico wrote:
> On Wed, Feb 12, 2014 at 2:36 AM, Travis Griggs 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 to methods
>>
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
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. Semantic
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 to
> 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 cheaper and
> more feasible
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 imports
> 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, wh
> On Feb 2, 2015, at 5:20 AM, Antoon Pardon
> 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 the screen I sudde
> On Feb 3, 2015, at 1:00 PM, Poul Riis 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 bit of expe
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 wrote:
>
> On Wed, Feb 4, 2015 at 9:50 AM, Travis Griggs wrote:
>> I really like pymongo. And I really like Python. But one thing my fingers
>> really get tired of typing is
>>
>> someDoc[‘_’id’]
>>
>> Thi
ility.
Sorry Dave, couldn’t resist. Clearly a balance between extremes is desirable.
(Mark, I intentionally put the blank lines in this time )
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 21, 2014, at 6:32 AM, Roy Smith wrote:
> In article ,
> 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 second form is distinctly easier to read"
> and,
On Feb 21, 2014, at 4:13 AM, Ned Batchelder 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 variables. In
> fact, they w
> On Feb 23, 2014, at 17:09, Mark Lawrence 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 dummy name binding, rig
> On Mar 15, 2014, at 14:24, Mark H Harris wrote:
>
> test
Pass
--
https://mail.python.org/mailman/listinfo/python-list
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
Sent from my iPhone
> On May 24, 2014, at 7:35, blindanagram 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
>>>
>>> http://nothingbutsnark.svbtle
> On May 28, 2014, at 3:43, Sameer Rathoud 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.
> --
> https://mail.pyt
On Sep 16, 2013, at 4:33 PM, William Bryant 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 = List.count(i)
>
er, here's how to take it to
the semi secure public level using a real web framework."
Travis Griggs
-- I multiple all estimates by pi to account from running around in circles.
--
https://mail.python.org/mailman/listinfo/python-list
ied Chris's example input to look like:
alpha
*beta
gamma+
delta
epsilon
zeta
*eta
kappa
tau
pi+
omicron
And then shot it with the following:
#!/usr/bin/env python3
with open("samplein.txt") as file:
reversing = False
for line in (raw.strip() for raw in file):
if revers
On Sep 23, 2013, at 8:06 AM, Chris Friesen 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, instance, do_cast
;t see is how to generate a 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 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 compil
python developer though. It's too bad there's not a forum "in between" to
share/ask for help with these kinds of things.
--Travis Griggs
"I multiply all estimates by pi to account for running around in circles"
--
https://mail.python.org/mailman/listinfo/python-list
> On Feb 24, 2015, at 9:47 PM, Steven D'Aprano
> 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/
>
Does it do python3.4 yet?
--
h
> On Feb 25, 2015, at 12:45 PM, Mark Lawrence 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
learned some things. I e
> On Mar 1, 2015, at 5:53 PM, Dennis Lee Bieber wrote:
>
> On Sun, 1 Mar 2015 20:16:26 + (UTC), alister
> declaimed the following:
>
>>
>> The language is called English, the clue is in the name. interestingly
>> most 'Brits' can switch between American English & English without too
>>
> On Mar 24, 2015, at 8:28 PM, Chris Angelico wrote:
>
> On Wed, Mar 25, 2015 at 2:13 PM, 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 into 1
>> by treating them as if
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 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 serialize your a
> On Apr 4, 2015, at 4:43 PM, Damien George 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 microcontrollers.
>
> Since our
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 4
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 .stat() object that helps me.
I could of course
> On Jun 5, 2014, at 1:14, Alain Ketterlin 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 worry about cycles in py
On Jun 4, 2014, at 4:01 AM, Tim Chase 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 gain for using utf8 internall
bar,
>baz,
>)
Ok, here's irony. I'm looking at that thinking "what the heck is he talking
about?!?". And then my brain catches up. My mail reader is of course "modern"
and does not use a mono space font. So the value of the along ed indent is los
> On Aug 4, 2014, at 22:57, Chris Angelico wrote:
>
> On Tue, Aug 5, 2014 at 3:47 PM, Satish ML 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' would work.
Until python4 in
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 i
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 n
(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 here
On Sep 8, 2014, at 5:06 PM, Chris Angelico 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 jessie runnin
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 pyth
On Sep 11, 2014, at 11:18 AM, Chris “Kwpolska” Warrick
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():
Thread(target=pushTelemetry.udpLoop).start()
On Sep 11, 2014, at 2:29 PM, Ervin Hegedüs 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
>> wrote:
>>
>>> Depends what you want.
>>
>
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()
o
On Sep 12, 2014, at 12:05 PM, Travis Griggs 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
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).
:)
--
https://mail.python.org
gle(self):
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/listinfo/python-list
or any help or pointers or hints 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