Steven D'Aprano wrote:
> On Thu, 21 Jan 2010 17:56:00 -0800, [email protected] wrote:
>
>> Is there a built-in method in python that lets you specify a "default"
>> value that will be returned whenever you try to access a list item that
>> is out of bounds?
>
> No.
>
>
>> Basically, it would
* Stefan Behnel:
Alf P. Steinbach, 21.01.2010 20:24:
Do you understand how bad that makes you look?
I think the right thing to say at this point is "don't feed the troll".
I find it amazing that you continue this kind of ad hominem attack. You leave it
open who you regard as trolling, but w
Steven D'Aprano wrote:
> I think this really is the correct solution for your problem. In
> Python, the standard place to have such public constants is at the
> module level, not the function or class. I think you're worrying
> unnecessarily about "namespace pollution" -- the module namespace is
>
Carl Banks wrote:
> I see. Well, Python is a poor choice for defining an internal DSL
> (i.e., DSL using the general language's syntax), because it's
> (deliberately) rigid in both grammar and semantics.
I had this impression too.
> Paul McGuire should be by to recommend PyParsing shortly.
* Martin Drautzburg:
Here is a complete expample using a decorator, still a bit noisy
def move(aDirection):
print "moving " + aDirection
#Here comes the decorator
def scope(aDict):
def save(locals):
"""Set symbols in locals and remember their original state"""
setSymbols
It looks like the python install environment is easily movable between
two machine with the same OS (I mean, with the correct libraries)...
Can I use this in production?
Please consider the following test, after I use ./configure
--prefix=/opt/python2.6.4 && make && make install:
[r...@centos
Wilbert Berendsen wrote:
> # sort the keys, longest first, so 'aa' gets matched before 'a', because
> # in Python regexps the first match (going from left to right) in a
> # |-separated group is taken
> keys = sorted(mapping.keys(), key=len, reverse=True)
>
This would do just as well (although
hi, I'm wondering if there are any Python programming environments
that enable live code reloading, for example something like the Scheme-
based impromptu (but also meant for any kind of Python program, not
just audio/visual generation).
Currently I do this directly in my editor (for game developm
On Jan 21, 11:43 pm, Martin Drautzburg
wrote:
> > Paul McGuire should be by to recommend PyParsing shortly.
>
> I looked it up and it seems to be about parsing strings. This is not
> what I am looking for as it would create a separate world outside of
> python. But I haven't looked deeply yet.
We
Hi Martin,
On Jan 21, 2010, at 8:43 AM, Martin Drautzburg wrote:
Hello all,
When passing parameters to a function, you sometimes need a paramter
which can only assume certain values, e.g.
def move (direction):
...
If direction can only be "up", "down", "left" or "right",
Steven D'Aprano wrote:
(3) Then somone suggested to tie the constants to the function itself,
as in
def move(direction):
print "moving %s" % direction
move.UP = 'up'
move.DOWN = 'down'
This is quite nice.
I would call it a horrible, horrible, horrible code smell. A stench in
fact.
21-01-2010, 22:51:34 Martin Drautzburg wrote:
Thanks for all the answers. Let me summarize
(1) [...]
(2) Using enum's was suggested. That is good to know, but again it is
just a way to define constants in the caller's namespace. [...]
(3) Then somone suggested to tie the constants to the funct
s/sollution/solution
s/event implemented/even implemented
Sorry
*j
--
http://mail.python.org/mailman/listinfo/python-list
Jean-Michel Pichavant writes:
> Steven D'Aprano wrote:
> > I would call it a horrible, horrible, horrible code smell. A stench
> > in fact.
[…]
> As soon as it is properly documented, as a public interface should be,
> it becomes an acceptable design, IMO.
[…]
So your position seems to be that
Does using the decimal module incur a penalty because it imports threading or do
I have to actually start a thread?
--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 22, 11:11 am, Robin Becker wrote:
> Does using the decimal module incur a penalty because it imports threading or
> do
> I have to actually start a thread?
There is at least one threading-related performance penalty that
doesn't involve the user actually starting a thread: any arithmetic
Roald de Vries wrote:
Hi Martin,
On Jan 21, 2010, at 8:43 AM, Martin Drautzburg wrote:
Hello all,
When passing parameters to a function, you sometimes need a paramter
which can only assume certain values, e.g.
def move (direction):
...
If direction can only be "up", "dow
On 22 Jan., 11:56, Roald de Vries wrote:
> Hi Martin,
>
> On Jan 21, 2010, at 8:43 AM, Martin Drautzburg wrote:
>
>
>
>
>
> > Hello all,
>
> > When passing parameters to a function, you sometimes need a paramter
> > which can only assume certain values, e.g.
>
> > def move (direction):
> >
Hello
I use a dictionary to keep a list of users connected to a web site.
To avoid users from creating login names that start with digits in
order to be listed at the top, I'd like to sort the list differently
every minute so that it'll start with the next letter, eg. display the
list from A...Zd
On Jan 22, 2010, at 1:06 PM, Martin Drautzburg wrote:
On 22 Jan., 11:56, Roald de Vries wrote:
Hi Martin,
On Jan 21, 2010, at 8:43 AM, Martin Drautzburg wrote:
Hello all,
When passing parameters to a function, you sometimes need a paramter
which can only assume certain values, e.g.
On Jan 21, 10:57 pm, Martin Drautzburg
wrote:
> Here is a complete expample using a decorator, still a bit noisy
>
> def move(aDirection):
> print "moving " + aDirection
>
> #Here comes the decorator
> def scope(aDict):
> def save(locals):
> [...]
Have you considered making 'scope' a cont
On 22/01/2010 11:50, Mark Dickinson wrote:
On Jan 22, 11:11 am, Robin Becker wrote:
Does using the decimal module incur a penalty because it imports threading or do
I have to actually start a thread?
There is at least one threading-related performance penalty that
doesn't involve the user act
On Fri, 22 Jan 2010 09:12:46 +0100, Martin Drautzburg wrote:
> Defining those symbols at the module level is absolutely fine with me.
> The namespace pollution is indeed my biggest worry. You see, I want to
> be able to type in lots of lines with little effort. Preferably I would
> want to type
>
Ben Finney wrote:
Jean-Michel Pichavant writes:
Steven D'Aprano wrote:
I would call it a horrible, horrible, horrible code smell. A stench
in fact.
[…]
As soon as it is properly documented, as a public interface should be,
it becomes an acceptable design, IMO.
[…]
On Fri, 22 Jan 2010 09:29:18 +0100, Alf P. Steinbach wrote:
> But have you tested this within a function or class, which is what the
> use of "locals" implies?
>
> The reason that I ask is that in the documentation of locals() it says
> this:
>
>Note
>The contents of this dictionary shou
Gilles Ganault wrote:
Hello
I use a dictionary to keep a list of users connected to a web site.
To avoid users from creating login names that start with digits in
order to be listed at the top, I'd like to sort the list differently
every minute so that it'll start with the next letter, eg. disp
Jean-Michel Pichavant wrote:
Gilles Ganault wrote:
Hello
I use a dictionary to keep a list of users connected to a web site.
To avoid users from creating login names that start with digits in
order to be listed at the top, I'd like to sort the list differently
every minute so that it'll start
On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault
wrote:
>I see that dictionaries can be sorted using the... sort() method, but
>is it possible to have Python start sorting from a different letter?
Looks like the solution is to read the list of keys into a list, sort
the list, and then use this
* Steven D'Aprano -> Alf P. Steinbach:
No, you got it spot on. Not to discourage you, but you're at least the
third person who pointed this out in this thread.
I get the impression that there's some message traffic that I don't see, perhaps
on the mailing list, since (a) I haven't seen that
On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault wrote:
> Hello
>
> I use a dictionary to keep a list of users connected to a web site.
>
> To avoid users from creating login names that start with digits in order
> to be listed at the top, I'd like to sort the list differently every
> minute s
On Fri, 22 Jan 2010 13:24:05 +, Steven D'Aprano wrote:
> On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault wrote:
[...]
>> I see that dictionaries can be sorted using the... sort() method, but
>> is it possible to have Python start sorting from a different letter?
>
> You can write a custome
On Friday 22 January 2010, Alf P. Steinbach wrote:
> I get the impression that there's some message traffic that I don't
> see
> For example, the recent thread "Covert number into string" started
> with a reply in my newreader, using EternalSeptember's NNTP host.
>
> It also starts with a reply
On 2010-01-22, Gilles Ganault wrote:
> Hello
>
> I use a dictionary to keep a list of users connected to a web
> site.
>
> To avoid users from creating login names that start with digits
> in order to be listed at the top, I'd like to sort the list
> differently every minute so that it'll start wi
On 22 Jan 2010 13:35:26 GMT, Neil Cerutti wrote:
>Resorting is more work than is needed. Just choose a different
>starting index each time you display the names, and set up your
>lister to wrap-around to your arbitrary starting index.
Thanks. In this case, it means that in each loop iteration, I
In the python help for itertools, the following function is provided:
def consume(iterator, n):
"Advance the iterator n-steps ahead. If n is none, consume
entirely."
collections.deque(islice(iterator, n), maxlen=0)
What is the advantage of using a collections.deque against, say, the
follo
* Steven D'Aprano:
One implementation-specific trick is that modifying locals does actually
work inside a class definition (at least in Python 2.5):
class Foo(object):
... x = 1
... print locals()
... locals()['x'] = 2
...
{'x': 1, '__module__': '__main__'}
Foo.x
2
But it doe
On Jan 22, 1:58 pm, Gilles Ganault wrote:
> On 22 Jan 2010 13:35:26 GMT, Neil Cerutti wrote:
>
> >Resorting is more work than is needed. Just choose a different
> >starting index each time you display the names, and set up your
> >lister to wrap-around to your arbitrary starting index.
>
> Thanks
On Fri, 22 Jan 2010 14:09:43 +0100, Jean-Michel Pichavant
wrote:
>Sorry, the code I provided produce this output:
>
>['1a', 'a', 'ac', 'av', 'b', 'c']
>['a', 'ac', 'av', 'b', 'c', '1a']
>['b', 'c', '1a', 'a', 'ac', 'av']
>['c', '1a', 'a', 'ac', 'av', 'b']
>['1a', 'a', 'ac', 'av', 'b', 'c']
>
>whic
* Wolfgang Rohdewald:
On Friday 22 January 2010, Alf P. Steinbach wrote:
I get the impression that there's some message traffic that I don't
see
For example, the recent thread "Covert number into string" started
with a reply in my newreader, using EternalSeptember's NNTP host.
It also start
22-01-2010 Steven D'Aprano wrote:
On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault wrote:
To avoid users from creating login names that start with digits in order
to be listed at the top, I'd like to sort the list differently every
minute so that it'll start with the next letter, eg. displ
Gilles Ganault wrote:
Hello
I use a dictionary to keep a list of users connected to a web site.
To avoid users from creating login names that start with digits in
order to be listed at the top, I'd like to sort the list differently
every minute so that it'll start with the next letter, eg. disp
On Fri, 22 Jan 2010 09:49:32 -0500, Dave Angel wrote:
>Seems to me the other solutions I've seen so far are more complex than
>needed. I figure you either want an unordered list, in which case you
>could use random.shuffle(), or you want a list that's sorted, but starts
>somewhere in the middl
Muhammad Alkarouri writes:
> In the python help for itertools, the following function is provided:
>
> def consume(iterator, n):
> "Advance the iterator n-steps ahead. If n is none, consume
> entirely."
> collections.deque(islice(iterator, n), maxlen=0)
>
> What is the advantage of using
Gilles Ganault writes:
> On Fri, 22 Jan 2010 09:49:32 -0500, Dave Angel wrote:
>>Seems to me the other solutions I've seen so far are more complex than
>>needed. I figure you either want an unordered list, in which case you
>>could use random.shuffle(), or you want a list that's sorted, but s
Muhammad Alkarouri writes:
> In the python help for itertools, the following function is provided:
>
> def consume(iterator, n):
> "Advance the iterator n-steps ahead. If n is none, consume
> entirely."
> collections.deque(islice(iterator, n), maxlen=0)
>
> What is the advantage of using
Jean-Michel Pichavant wrote:
> Here is one possible solution
>
> l = ['1a', 'a', 'b','c','av','ac'] # you mentioned a dictionary in your
> post, if so, l = myDict.keys()
> l.sort() # sort your list once and for all
> for start in '1abcd':
> result = [name for name in l if name[0] >= start]
In the python help for itertools, the following function is provided:
def consume(iterator, n):
"Advance the iterator n-steps ahead. If n is none, consume
entirely."
collections.deque(islice(iterator, n), maxlen=0)
What is the advantage of using a collections.deque against, say, the
foll
PS.
22-01-2010 o 15:44:28 Jan Kaliszewski wrote:
22-01-2010, 14:58:58 Gilles Ganault wrote:
On 22 Jan 2010 13:35:26 GMT, Neil Cerutti wrote:
Resorting is more work than is needed. Just choose a different
starting index each time you display the names, and set up your
lister to wrap-around
On Fri, 22 Jan 2010 13:35:26 +, Neil Cerutti wrote:
> On 2010-01-22, Gilles Ganault wrote:
>> Hello
>>
>> I use a dictionary to keep a list of users connected to a web site.
>>
>> To avoid users from creating login names that start with digits in
>> order to be listed at the top, I'd like to
In article ,
MRAB wrote:
>D'Arcy J.M. Cain wrote:
>> On Thu, 14 Jan 2010 07:52:58 -0800 (PST)
>> chandra wrote:
>>> Folks,
>>>
>>> I am new to Python and could not find a function along the lines of
>>
>> Welcome.
>>
>>> string.ishex in Python. There is however, a string.hexdigits constant
>>> i
On 2010-01-22, Steven D'Aprano wrote:
> On Fri, 22 Jan 2010 13:35:26 +, Neil Cerutti wrote:
>> On 2010-01-22, Gilles Ganault wrote:
>>> Hello
>>>
>>> I use a dictionary to keep a list of users connected to a web site.
>>>
>>> To avoid users from creating login names that start with digits in
Gilles Ganault wrote:
On Fri, 22 Jan 2010 14:09:43 +0100, Jean-Michel Pichavant
wrote:
Sorry, the code I provided produce this output:
['1a', 'a', 'ac', 'av', 'b', 'c']
['a', 'ac', 'av', 'b', 'c', '1a']
['b', 'c', '1a', 'a', 'ac', 'av']
['c', '1a', 'a', 'ac', 'av', 'b']
['1a', 'a', 'ac', 'a
In article ,
Duncan Booth wrote:
>
>That seems overkill. This does pretty much the same thing:
>
> @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF
> import sys
> print sys.version
> # raise RuntimeError # uncomment to trigger the 'pause'
What version of Windows is
* Aahz:
In article ,
Duncan Booth wrote:
That seems overkill. This does pretty much the same thing:
@(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF
import sys
print sys.version
# raise RuntimeError # uncomment to trigger the 'pause'
What version of Wi
On Fri, 22 Jan 2010 09:49:32 -0500, Dave Angel wrote:
> Seems to me the other solutions I've seen so far are more complex than
> needed. I figure you either want an unordered list, in which case you
> could use random.shuffle(), or you want a list that's sorted, but starts
> somewhere in the midd
Jean-Michel Pichavant wrote:
Gilles Ganault wrote:
On Fri, 22 Jan 2010 14:09:43 +0100, Jean-Michel Pichavant
wrote:
Sorry, the code I provided produce this output:
['1a', 'a', 'ac', 'av', 'b', 'c']
['a', 'ac', 'av', 'b', 'c', '1a']
['b', 'c', '1a', 'a', 'ac', 'av']
['c', '1a', 'a', 'ac', 'a
On Fri, 22 Jan 2010 15:57:07 +, Neil Cerutti wrote:
> On 2010-01-22, Steven D'Aprano
> wrote:
>> Unless you can predict what index to use for (say) names starting with
>> "B", then your scheme doesn't work. In order to find that index, you
>> have to do a linear search of the list after every
On Thu, 21 Jan 2010 11:25:08 +0100, Tomas Pelka wrote:
> have a problem with following piece of code:
>
> --
> import subprocess
>
> paattern = "python"
> cmd = "/usr/bin/locate"
> arg1 = " -i"
> arg2 = " -d /var/www/books/mlocate.db"
> arg3 = str(
On 2010-01-22, Steven D'Aprano wrote:
>> O(N*Log N) + O(N) == O(N**2)?
>
> Oops! :(
>
> Of course, the sort is in fast C, and the linear search is in
> relatively slow Python, so it is quite conceivable that for
> realistic amounts of data, the time could be dominated by the
> searching.
>
> Or t
Gilles Ganault wrote:
On Fri, 22 Jan 2010 09:49:32 -0500, Dave Angel wrote:
Seems to me the other solutions I've seen so far are more complex than
needed. I figure you either want an unordered list, in which case you
could use random.shuffle(), or you want a list that's sorted, but starts
[email protected] (Aahz) wrote:
> In article ,
> Duncan Booth wrote:
>>
>>That seems overkill. This does pretty much the same thing:
>>
>> @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF
>> import sys
>> print sys.version
>> # raise RuntimeError # uncomme
On 22 Jan 2010 15:24:58 GMT, Duncan Booth
wrote:
>Here's another:
Thanks for the sample. It work great, except that it also runs when
the header character doesn't match any item in the list:
===
import bisect
connected = []
connected.append("_test")
connected.append("-test")
connected.appen
On Fri, 22 Jan 2010 17:21:02 +0100, Jean-Michel Pichavant
wrote:
>Ok I realized that picking up a random index prevent from grouping names
>starting with the same letter (to ease visual lookup).
>Then go for the random char, and use char comparison (my first example).
Yup, I think it's a good en
On Jan 20, 8:30 pm, Gringo wrote:
> On 1/20/2010 12:38, ben wrote:
>
>
>
> > Hello,
>
> > I am following through the python tutorial which gets to a line that
> > uses the * operator with zip(). I searched and searched but could find
> > no information on the operator or how to use it in general.
Steven D'Aprano wrote:
On Fri, 22 Jan 2010 09:49:32 -0500, Dave Angel wrote:
Seems to me the other solutions I've seen so far are more complex than
needed. I figure you either want an unordered list, in which case you
could use random.shuffle(), or you want a list that's sorted, but starts
On Jan 21, 9:00 pm, Michele Simionato
wrote:
> Just for fun I have run cloc on our trunk:
>
> SUM: 8743 272238 215871 1470139 x 1.84 =
> 2708354.95
Nice!
My favorite version of a cloc system can distinguish test from
production code. That's why I always use executable c
On Jan 22, 6:13 am, Muhammad Alkarouri wrote:
> In the python help for itertools, the following function is provided:
>
> def consume(iterator, n):
> "Advance the iterator n-steps ahead. If n is none, consume
> entirely."
> collections.deque(islice(iterator, n), maxlen=0)
>
> What is the a
The v2.6.4 version of the tutorial says this:
'''
It is also possible to use a list as a queue, where the first element
added is the first element retrieved (“first-in, first-out”); however,
lists are not efficient for this purpose. While appends and pops from
the end of list are fast, doing inser
Mark Dickinson wrote:
> On Jan 21, 10:57 pm, Martin Drautzburg
> wrote:
>> Here is a complete expample using a decorator, still a bit noisy
>>
>> def move(aDirection):
>> print "moving " + aDirection
>>
>> #Here comes the decorator
>> def scope(aDict):
>> def save(locals):
>> [...]
>
> Have you
Hi,
I need to create a python subprogress, like this:
myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'],
env=env, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
sys.executable was printed out as ''C:\\Pyth
This has probably been asekd a million times, but if someone could give
a short answer anyways I's be most grateful.
What is it that allows one to write A.x? If I have a variable A, then
what to I have to assign to it to A.x becomes valid?
Or even further: what do I have to do so I can write A.x=
On Jan 22, 11:29 am, Martin Drautzburg
wrote:
> This has probably been asekd a million times, but if someone could give
> a short answer anyways I's be most grateful.
Not sure there is exactly a short answer, and I am only qualified to
maybe clarify some of the things you can and cannot do, not e
On Fri, Jan 22, 2010 at 11:14 AM, Steve Howell wrote:
> The v2.6.4 version of the tutorial says this:
>
> '''
> It is also possible to use a list as a queue, where the first element
> added is the first element retrieved (“first-in, first-out”); however,
> lists are not efficient for this purpose.
Martin Drautzburg wrote:
>> with scope():
>> # ...
>> # use up, down, left, right here
>>
>> # up, down, left, right no longer defined after the with block exits.
Just looked it up again. It's a cool thing. Too bad my locals() hack
would still be required. The result would be less noisy
On Jan 22, 12:14 pm, Chris Rebert wrote:
> On Fri, Jan 22, 2010 at 11:14 AM, Steve Howell wrote:
> > The v2.6.4 version of the tutorial says this:
>
> > '''
> > It is also possible to use a list as a queue, where the first element
> > added is the first element retrieved (“first-in, first-out”);
On 1/22/2010 7:17 AM, Gilles Ganault wrote:
Hello
I use a dictionary to keep a list of users connected to a web site.
To avoid users from creating login names that start with digits in
order to be listed at the top, I'd like to sort the list differently
every minute so that it'll start with the
Steve Howell wrote:
> Is that really true in CPython? It seems like you could advance the
> pointer instead of shifting all the elements. It would create some
> nuances with respect to reclaiming the memory, but it seems like an
> easy way to make lists perform better under a pretty reasonable us
On Jan 22, 12:40 pm, Christian Heimes wrote:
> Steve Howell wrote:
> > Is that really true in CPython? It seems like you could advance the
> > pointer instead of shifting all the elements. It would create some
> > nuances with respect to reclaiming the memory, but it seems like an
> > easy way t
Steve Howell writes:
> On Jan 22, 12:14 pm, Chris Rebert wrote:
>> On Fri, Jan 22, 2010 at 11:14 AM, Steve Howell wrote:
>> > The v2.6.4 version of the tutorial says this:
>>
>> > '''
>> > It is also possible to use a list as a queue, where the first element
>> > added is the first element retr
On Jan 22, 3:16 am, George Oliver wrote:
> hi, I'm wondering if there are any Python programming environments
> that enable live code reloading, for example something like the Scheme-
> based impromptu (but also meant for any kind of Python program, not
> just audio/visual generation).
>
> Current
On Jan 21, 10:54 am, Steve Howell wrote:
> Hi, I'm looking for ideas on building a simple architecture that
> allows a bunch of independent Python processes to exchange data using
> files and perform calculations.
>
> One Python program would be collecting data from boat instruments on a
> serial
On 1/22/2010 12:57 PM, ben wrote:
On Jan 20, 8:30 pm, Gringo wrote:
I am following through the python tutorial which gets to a line that
uses the * operator with zip().
All such questions are at least briefly answered in
my complete python3 symbol glossary (all syntax usages) at
http://code
Steve Howell wrote:
> I disagree that Python code rarely pops elements off the top of a
> list. There are perfectly valid use cases for wanting a list over a
> dequeue without having to pay O(N) for pop(0). Maybe we are just
> quibbling over the meaning of "rarely."
I was speaking from my own po
On Jan 22, 1:08 pm, Arnaud Delobelle wrote:
> Steve Howell writes:
> > On Jan 22, 12:14 pm, Chris Rebert wrote:
> >> On Fri, Jan 22, 2010 at 11:14 AM, Steve Howell wrote:
> >> > The v2.6.4 version of the tutorial says this:
>
> >> > '''
> >> > It is also possible to use a list as a queue, where
Robert Kern wrote:
> On 2010-01-21 15:31 , Phlip wrote:
>> Aahz wrote:
>>> In article
>>> <[email protected]>,
>>> Phlip wrote:
On Jan 20, 11:20=A0pm, Michele Simionato
wrote:
> pylint does too many things, I want something fast that ju
On 1/22/2010 2:14 PM, Steve Howell wrote:
The v2.6.4 version of the tutorial says this:
Is that really true in CPython? It seems like you could advance the
pointer instead of shifting all the elements. It would create some
nuances with respect to reclaiming the memory, but it seems like an
e
On Jan 21, 11:54 am, Steve Howell wrote:
> Hi, I'm looking for ideas on building a simple architecture that
> allows a bunch of independent Python processes to exchange data using
> files and perform calculations.
>
> One Python program would be collecting data from boat instruments on a
> serial
Arnaud Delobelle wrote:
> I made the comment you quoted. In CPython, it is O(n) to delete/insert
> an element at the start of the list - I know it because I looked at the
> implementation a while ago. This is why collections.deque exists I
> guess. I don't know how they are implemented but inser
Op donderdag 21 januari 2010 schreef Michele:
> I need a small utility to count the lines of Python code in a
> directory, traversing subdirectories and ignoring comments and
> docstrings.
sloccount can do this.
http://www.dwheeler.com/sloccount/
Met vriendelijke groet,
Wilbert Berendsen
--
h
On 22Jan2010 13:19, Mike Driscoll wrote:
| On Jan 22, 3:16 am, George Oliver wrote:
| > hi, I'm wondering if there are any Python programming environments
| > that enable live code reloading, for example something like the Scheme-
| > based impromptu (but also meant for any kind of Python program
On 1/22/2010 2:29 PM, Martin Drautzburg wrote:
This has probably been asekd a million times, but if someone could give
a short answer anyways I's be most grateful.
What is it that allows one to write A.x? If I have a variable A,
You do not really have a 'variable'. You have a name A bound to a
I was writing a script that counts occurrences of characters in source code
files:
#!/usr/bin/python
import codecs
tcounters = {}
f = codecs.open('/home/gavron/git/screen/src/screen.c', 'r', "utf-8")
for uline in f:
lline = []
for char in uline[:-1]:
lline += [char]
counters = {}
for
In article <80c56956-f28e-47a3-a723-3a5e3fd29...@j19g2000yqk.googlegroups.com>,
[email protected] wrote:
>On Jan 2, 9:35=A0pm, Dave Angel wrote:
>>
>> In Windows, there is a way to do it. It's just not exposed to the
>> Python built-in function open(). You use the CreateFile() function,
>> wit
On Jan 21, 9:21 am, Dave Angel wrote:
> Put it inside a dummy class, as follows:
This has been very educational, thank you for all the suggestions.
Here is the resulting code:
class Property: pass # example of a dummy class
Plist = Property() # create a Plist object from the dummy class
# accu
Chris Jones writes:
> I was writing a script that counts occurrences of characters in source
> code files:
>
> #!/usr/bin/python
> import codecs
> tcounters = {}
> f = codecs.open('/home/gavron/git/screen/src/screen.c', 'r', "utf-8")
> for uline in f:
> lline = []
> for char in uline[:-1]:
>
On Jan 22, 1:29 pm, Christian Heimes wrote:
> Steve Howell wrote:
> > I disagree that Python code rarely pops elements off the top of a
> > list. There are perfectly valid use cases for wanting a list over a
> > dequeue without having to pay O(N) for pop(0). Maybe we are just
> > quibbling over
im trying to update a patch. here is link to various patches
http://bugs.python.org/issue6075
how do i update the patch, say for EditorWindow.patch.
i have located my python installation the EditorWindow.py, and i can
see some differences (which lines from the patch actually go into the
EditorWind
Steve Howell wrote:
On Jan 22, 12:40 pm, Christian Heimes wrote:
Steve Howell wrote:
Is that really true in CPython? It seems like you could advance the
pointer instead of shifting all the elements. It would create some
nuances with respect to reclaiming the memory, but it seems like
On Jan 22, 1:32 pm, Terry Reedy wrote:
> On 1/22/2010 2:14 PM, Steve Howell wrote:
>
> > The v2.6.4 version of the tutorial says this:
> > Is that really true in CPython? It seems like you could advance the
> > pointer instead of shifting all the elements. It would create some
> > nuances with r
Arnaud Delobelle wrote:
Steve Howell writes:
On Jan 22, 12:14 pm, Chris Rebert wrote:
I made the comment you quoted. In CPython, it is O(n) to delete/insert
an element at the start of the list - I know it because I looked at the
implementation a while ago. This is why collections.
1 - 100 of 131 matches
Mail list logo