On 06/07/2018 12:45 AM, Chris Angelico wrote:
On Thu, Jun 7, 2018 at 1:55 PM, Steven D'Aprano
wrote:
On Tue, 05 Jun 2018 23:27:16 +1000, Chris Angelico wrote:
And an ASCIIZ string cannot contain a byte value of zero. The parallel
is exact.
Why should we, as Python programmers, care one whit
python3 --version
Python 3.5.3
Running on Debian stretch
In this code s is a string parameter
while (j < k and \
(s[j].isalnum()) or \
(s[j] in seps and s[j+1].isalnum()) ):
j = j + 1
print ("i = {0}, j = {1}, k = {2}, len[s] = {3}". \
format(i,
On 12/23/2016 01:56 PM, Charles Hixson wrote:
I was looking to avoid using a upd connection to transfer messages
between processes, so I thought I'd use multiprocessing (which I
expect would be faster), but...I sure would appreciate an explanation
of this problem.
When I run the
I was looking to avoid using a upd connection to transfer messages
between processes, so I thought I'd use multiprocessing (which I expect
would be faster), but...I sure would appreciate an explanation of this
problem.
When I run the code (below) instead of messages receiving messages from
th
I want to process a bunch of processes that all talk to each other. I've
figured out how to do this using queues with the main process as the mail
handler, but I'd rather have them talk directly. If I use connections, then I
can pass the pipes to the processes, but there doesn't seem to be anythin
I want to process a bunch of processes that all talk to each other.
I've figured out how to do this using queues with the main process as
the mail handler, but I'd rather have them talk directly. If I use
connections, then I can pass the pipes to the processes, but there
doesn't seem to be an
If I understand correctly asyncio, coroutines, etc. (and, of course,
Threads) are not simultaneously executed, and that if one wants that one
must still use multiprocessing. But I'm not sure. The note is still
there at the start of threading, so I'm pretty sure about that one.
The requiremen
On 02/09/2015 08:46 PM, Chris Angelico wrote:
On Tue, Feb 10, 2015 at 3:33 PM, Charles Hixson
wrote:
The proper version of the "hard way" is:
1) The __iter__ method of the iterable constructs a new iterator
instance and returns it.
2) The __iter__ method of the *iterator* simp
On 02/09/2015 03:56 PM, Ian Kelly wrote:
On Mon, Feb 9, 2015 at 4:30 PM, Steven D'Aprano
wrote:
The way you write iterators is like this:
Method 1 (the hard way):
- Give your class an __iter__ method which simply returns self:
def __iter__(self):
return self
- Give your clas
I'm trying to write a correct iteration over a doubly indexed container,
and what I've got so far is:def __next__ (self):
for rowinrange(self._rows):
for col in range(self._cols):
if self._grid[row][col]:
yieldself._grid[row]
On 12/31/2014 01:18 PM, MRAB wrote:
On 2014-12-31 19:33, Charles Hixson wrote:
In order to allow multiple processes to access a database (currently
SQLite) I want to run the process in a separate thread. Because it will
be accessed from multiple processes I intent to use Queues for shifting
In order to allow multiple processes to access a database (currently
SQLite) I want to run the process in a separate thread. Because it will
be accessed from multiple processes I intent to use Queues for shifting
messages back and forth. But none of the individuals processes will
know when al
What are the tradeoffs between using multiprocessing vs. using
asyncio.SubprocessProtocol?
This only one that I've noticed is that asyncio seems to require much
more hands-on management of message queueing. OTOH, I'm no expert in
either of them, and I might be missing something that will bite m
I don't think I can reduce it much beyond this. I'm trying to run
Sqlite in a separate process, but I'm running into problems.
*The code:*
from collectionsimportnamedtuple
from multiprocessing import Process, Queue, current_process
from queue import Empty, Full
Msg=namedtuple (
On 04/25/2014 10:53 AM, Charles Hixson wrote:
What is the proper way to delete selected items during iteration of a
map? What I want to do is:
for (k, v) in m.items():
if f(k):
# do some processing of v and save result elsewhere
del m[k]
But this gives (as should be expected
during iteration
In the past I've accumulated the keys to be deleted in a separate list,
but this time there are likely to be a large number of them, so is there
some better way?
--
Charles Hixson
--
https://mail.python.org/mailman/listinfo/python-list
isn't too important, as I was just going to request a
documentation change, but it happening may be more important than what I
would have entered.
--
Charles Hixson
--
https://mail.python.org/mailman/listinfo/python-list
On 01/20/2014 08:14 PM, Dan Stromberg wrote:
On Mon, Jan 20, 2014 at 12:09 PM, Charles Hixson
wrote:
class RODict:
#Instance Variable Doc
##@var_ddict
#This variable holds the reference to the dict.
##Class initializer.
#@paramddictThe
On 01/20/2014 04:08 PM, Chris Angelico wrote:
On Tue, Jan 21, 2014 at 7:09 AM, Charles Hixson
wrote:
#@note Instances can be created only from existing dicts.
##Class initializer.
#@paramddictThe data dictionary to which this is a read only
On 01/20/2014 12:52 PM, Peter Otten wrote:
Charles Hixson wrote:
This is just a first sketch, and I haven't yet attempted to test it, so
what I'm hoping for is criticisms on the general approach.
class RODict:
def __init__ (self, ddict = {}):
Default values are evaluted just
nlen(self._ddict)
--
Charles Hixson
--
https://mail.python.org/mailman/listinfo/python-list
talking about changing their value through other means of
access rather than directly through the returned values.)
P.S.: Is it reasonable to return the items() of a dict in order to pass
a read only copy of the values?
--
Charles Hixson
--
https://mail.python.org/mailman/listinfo/python-list
tion, but Scheme could be considered a
part of the Lisp clade.
--
Charles Hixson
--
https://mail.python.org/mailman/listinfo/python-list
machine, implemented by an underneath microcode layer.)
You can reasonably say that an implementation of Python is done in terms
of a virtual machine. (Usually I don't bother about this kind of
nit-pick, but in this discussion it seems apropos.)
--
Charles Hixson
--
https://mail.python.org/mailman/listinfo/python-list
ally show up, as changes that they
would catch happen quite rarely, but...)
OTOH, neither one really fits in as, say, an included module...they're
more like idle, which now that I look does have a "check module" run
option. Perhaps that invokes one of them. I note that Idle
On 04/15/2013 10:14 AM, Charles Hixson wrote:
On 04/14/2013 07:32 PM, Chris Rebert wrote:
On Apr 14, 2013 4:27 PM, "Charles Hixson" <mailto:charleshi...@earthlink.net>> wrote:
>
> What is the best approach to implementing actors that accept and
post messages (a
On 04/14/2013 07:32 PM, Chris Rebert wrote:
On Apr 14, 2013 4:27 PM, "Charles Hixson" <mailto:charleshi...@earthlink.net>> wrote:
>
> What is the best approach to implementing actors that accept and
post messages (and have no other external contacts).
You migh
space
would be wasted. Or if the queues could dynamically resize. Or if
there was a threadsafe dict. Or... But I don't know that any of these
are feasible. (I mean, yes, I could write all the mail to a database,
but is that a better answer, or even a good one?)
--
Charles Hixson
, but I can't stand
having it appear for some of my functions, and not for others, and I
haven't been able to figure out what turns it on or off.
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
cas...@gmail.com wrote:
On Thursday, October 25, 2012 7:56:25 AM UTC-7, Charles Hixson wrote:
In Python3 is there any good way to count the number of on bits in an
integer (after an& operation)?
You may want to look at gmpy2[1] and the popcount() function.
Alternatively, is there any
s, or their equivalents in
terms of union and intersection.)
Or do I need to drop into C for this?
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
ion
significantly.
Really nice and good to know. I had guessed the other way. (As you
point out this is compiler dependent, and I'll be using Python3,
but...conversion from an int to a bit string must be a *lot* faster than
I had thought.)
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
s, or their equivalents in
terms of union and intersection.)
Or do I need to drop into C for this?
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
s, or their equivalents in
terms of union and intersection.)
Or do I need to drop into C for this?
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
On 10/20/2012 04:28 PM, Ian Kelly wrote:
On Sat, Oct 20, 2012 at 2:03 PM, Charles Hixson
wrote:
If I run the following code in the same module, it works correctly, but if I
import it I get the message:
Exception RuntimeError: 'generator ignored GeneratorExit' in ignored
def
raiseStopIteration
The message appears to be purely informational, but I *would* like to
fix whatever problem it's reporting, and none of the changes that I've
tried have worked. What *should* I be doing?
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
On 06/25/2012 12:48 AM, Steven D'Aprano wrote:
On Sun, 24 Jun 2012 16:16:25 -0700, Charles Hixson wrote:
But what I wanted was to catch any exception.
Be careful of what you ask for, since you might get it.
"Catch any exception" is almost certainly the wrong thin
On 06/24/2012 11:23 PM, Andrew Berg wrote:
On 6/25/2012 12:27 AM, Charles Hixson wrote:
The documentation section covering the except statement could stand to
be a *LOT* clearer. I read the sections on the except statement and
exception handlers several times and couldn't figure ou
On 06/24/2012 03:43 PM, Charles Hixson wrote:
On 06/24/2012 03:36 PM, Chris Angelico wrote:
On Mon, Jun 25, 2012 at 8:26 AM, Charles Hixson
wrote:
The code:
finally:
print ("at finally")
print ("chunks =")
produces
On 06/24/2012 03:43 PM, MRAB wrote:
On 24/06/2012 23:26, Charles Hixson wrote:
The code:
print("pre-chunkLine")
chunks=[]
try:
chunks=self.chunkLine (l)
Sorry, I left out:
er$ python3 --version
Python 3.2.3rc1
On 06/24/2012 03:26 PM, Charles Hixson wrote:
The code:
print("pre-chunkLine")
chunks=[]
try:
chunks=self.chunkLine (l)
ons as to what's wrong with the code?
FWIW, chunkLine begins:
def chunkLine (self, line):
print("chunkLine: ")
print ("line = ", line)
ifline == None:
return[]
assert(isinstance (line, str) )
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
On 05/21/2012 08:29 AM, Charles Hixson wrote:
message excerpt:
flush: sql = insert or replace into persists (id, name, data, rdCnt,
rdTim, wrCnt, wrTim, deprecation) values (?, ?, ?, ?, ?, ?, ?, ?)
Exception TypeError: "'NoneType' object is not callable" in method Shelve2.
re the
class, thus:
defnowI():
t=int (time() * 100)
returnt
All I can guess is that there's some reason that an external to the
class function shouldn't be called during a __del__. Is this correct?
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
On 05/19/2012 06:39 AM, Adam Tauno Williams wrote:
On Fri, 2012-05-18 at 09:53 -0700, Charles Hixson wrote:
Does __slots__ make access to variables more efficient?
Absolutely, yes.
If one uses property() to create a few read-only pseudo-variables, does
that negate the
Does __slots__ make access to variables more efficient?
If one uses property() to create a few read-only pseudo-variables, does
that negate the efficiency advantages of using __slots__?
(Somehow I feel the documentation needs a bit of improvement.)
--
Charles Hixson
--
http://mail.python.org
On 05/16/2012 03:11 PM, Ian Kelly wrote:
On Wed, May 16, 2012 at 3:52 PM, Charles Hixson
wrote:
I want to persist simple dicts, but due to the security problems with
(un)pickle, I'd prefer to not use shelve, and the only way I could see to
persist them onto sqlite also invoked pickle
e a simple convert to and from either bytes or strings.
repr works well for the conversion into string (I said they were
simple), but I'd really rather be able to turn "{'a': 'A', 1: 23, 2:
['b', 2]}" back into a dict without allowing the execution of arb
On 05/08/2012 01:19 PM, Adam Tauno Williams wrote:
On Mon, 2012-05-07 at 20:15 -0700, Charles Hixson wrote:
class Node:
def__init__(self, nodeId, key, value, downRight, downLeft, parent):
dirty=True
dlu=utcnow()
self.node
On 05/08/2012 12:50 AM, Peter Otten wrote:
Charles Hixson wrote:
class Node:
def__init__(self, nodeId, key, value, downRight, downLeft,
parent):
dirty=True
dlu=utcnow()
self.node=[nodeId, downLeft, [key], [value
On 05/07/2012 08:44 PM, Dan Sommers wrote:
On Mon, 07 May 2012 20:15:36 -0700
Charles Hixson wrote:
class Node:
def__init__(self, nodeId, key, value, downRight, downLeft,
parent): dirty=True
dlu=utcnow()
self.node=[nodeId, downLeft
On 05/07/2012 08:33 PM, Chris Rebert wrote:
On Mon, May 7, 2012 at 8:15 PM, Charles Hixson
wrote:
class Node:
def__init__(self, nodeId, key, value, downRight, downLeft, parent):
dirty=True
dlu=utcnow()
self.node=[nodeId, downLeft
node[3] is a list
of values, etc.
What I'd like to do is to be able to address them thusly:
k = node.key[2]
v = node.value[2]
but if there's a way to do this, I haven't been able to figure it out.
Any suggestions?
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
That was it! Thanks.
On 12/26/2011 02:44 PM, Chris Angelico wrote:
On Tue, Dec 27, 2011 at 9:23 AM, Charles Hixson
wrote:
This doesn't cause a crash, but rather incorrect results.
You may need to be a bit clearer. What line of code (or what
expression)? What did you expect t
quot;\"", sep = "")
tmp=self.wordList[i][1] ## !! Kludge --
remove tmp to see the error
self.wordList[i]=tmp + self.wordList[i][1:-1] ## !!
Kludge -- remove tmp + to see the error
print ("1: wordList[", i, "] = \"", self.wordList[i], "\"", sep
= "")
print("len(wordList[", i, "]) = ", len(self.wordList[i]) )
--
Charles Hixson
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday 22 May 2008 13:30:07 Nick Craig-Wood wrote:
> ...
> >From Armstrong's book: The expression Pattern = Expression causes
>
> Expression to be evaluated and the result matched against Pattern. The
> match either succeeds or fails. If the match succeeds any variables
> occurring in Pattern
I hesitate to call this a bug, as at my level of expertise that seems
... unlikely. But I can't think of any other explanation:
This is an extract from some longer code:
print"item = ", item
print"item[0] < lvl = %d < %d = " %(item[0], lvl), bool(item[0] < lvl)
print"item[0] == lv
Grant Edwards wrote:
That seems to imply that you think market sucess == technical
merits. Unless you mean that Prothon was a technical failure
rather than a market-share failure...
As Prothon never got as far as an alpha stage product, I don't think you
could call it a technical success. It
Terry Reedy wrote:
"Luis M. Gonzalez" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
...
It is as important and "python related" as other projects
such as PyPy, Stackless,
but I think this is silly. PyPy is an alternate implementation of Python,
not a different language.
59 matches
Mail list logo