Apologies in advance to anyone who has this post mangled, I use a couple
Unicode characters at the end and Thunderbird wants to use UTF8 for the
message encoding. Unless it does something weird, this post should
still be legible... but I'm not going to rely on that. :)
William Gill wrote:
>> 2
Stephan wrote:
> Can the CSV module be coerced to read two line formats at once or am I
> better off using read and split?
Well, readlines/split really isn't bad. So long as the file fits
comfortably in memory:
fi = open(file)
lines = fi.readlines()
evens = iter(lines[0::2])
odds = iter(lines[1
Jan-Ole Esleben wrote:
> class Meta(type):
> def __new__(cls, name, bases, d):
> d['classvar'] = []
> return type.__new__(cls, name, bases, d)
The problem is that __new__ is called upon object construction, not
class definition, but you're trying to set the class variables at
definitio
Repton wrote:
>>This poses a small problem. I'm not sure whether this is a
>>Win32-related issue, or it's because the PRIMARY selection isn't fully
>>configured.
>
>
> You need to select something first :-)
>
That doesn't work for inter-process communication, though, at least not
with win32 n
John Roth wrote:
>
> "Mike Meyer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>>
>> So the only way to remove the global statement would be to have some
>> way to mark the other interpretation, with say a "local"
>> decleration. I thik that would be much worse than "global". For
Mike Meyer wrote:
> Another thread pointed out a couple of methods that would be nice to
> have on Python collections: find and inject. These are taken from
> http://martinfowler.com/bliki/CollectionClosureMethod.html >.
>
> find can be defined as:
>
> def find(self, test = None):
>
Robert Kern wrote:
> Jeff Schwab wrote:
>> Why are you retarded? Isn't the above code O(n)?
>>
>> Forgive me for not understanding, I'm still awfully new to Python
>> (having come from Perl & C++), and I didn't see an explanation in the
>> FAQ.
> (s for s in iter(self) is test(s)) is a generato
Jeff Schwab wrote:
> Robert Kern wrote:
>> Now, if I were to do
>>
>> item = g(self, test).next()
>>
>> the generator would execute the code until it reached the yield
>> statement which happens when it finds the first item that passes the
>> test. That item will get returned, and execution doe
Maksim Kasimov wrote:
>
> Hello,
>
> i have a class, such as below.
> when i try to make instances of the class,
> fields __data1 and __data2 gets different values: __data1 behaves
like private field, __data2 - like static
> which is the thing i've missed?
Firstly, you get interesting be
Gregory Piñero wrote:
> Hey guys, would someone mind giving me a quick rundown of how
> references work in Python when passing arguments into functions? The
> code below should highlight my specific confusion:
All arguments are passed by reference, but in Python equality rebinds
the name.
>
>
Dennis Lee Bieber wrote:
> In a more simplistic view, I'd reverse the phrasing... The name
> "x" is assigned to the object "y" (implying it is no longer attached to
> whatever used to have the name)
No, because that'd imply that the object 'y' somehow keeps track of the
names assigned to it
infidel wrote:
>>in Python equality rebinds the name
>
>
> Assignment (=) rebinds the name. Equality (==) is something else
> entirely.
Good catch. I was thinking of it as the "equals" operator.
--
http://mail.python.org/mailman/listinfo/python-list
Rocco Moretti wrote:
> Variables in Python are names. They aren't the cubbyholes into which you
> put values, they are sticky notes on the front of the cubby hole.
+1 MOTW (Metaphor of the Week)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I am hoping someone can help me solve a bit of a puzzle.
>
> We are working on a data file reader and extraction tool for an old
> MS-DOS accounting system dating back to the mid 80's.
>
> In the data files, the text information is stored in clearly readable
> ASCII tex
Dejan Rodiger wrote:
> 8003346488(10)=1DD096038(16)
> 1D D0 96 03 8
> 80 03 96 D0 1D 00
> 80 03 96 d0 fd 41 Add E041
I'm pretty sure that the last full byte is a parity check of some sort.
I still thing that Phone2 (..F1) is a typo and should be 41. Even if
it's not, it could be a more detail
Gregory Piñero wrote:
> So what if I do want to share a boolean variable like so:
Well, the easiest way is to wrap it in a list:
mybool = [True]
mybool[0] = False
mybool[0] = True
and so on.
Alternately, what is this boolean attached to that's so significant?
Sharing an arbitrary boolean, with
Grant Edwards wrote:
> That would just be sick. I can't imagine anybody on an 8-bit
> CPU using FP for a phone number.
Nobody on an 8-bit CPU would have a FPU, so I'll guarantee that this is
done using only 8 or 16-bit (probably 8) integer math.
--
http://mail.python.org/mailman/listinfo/python
Grant Edwards wrote:
> And I'll guarantee that the difference between 333- and
> 666- has to be more than 1-bit. There's no way that can be
> the correct data unless it's something like an index into a
> different table or a pointer or something along those lines.
Absolutely. I hadn't ev
ncf wrote:
> Hmm...thanks for the replies. Judging by this, it looks like I might
> still be in a slight perdiciment with doing it all, but time will tell.
> I wish there were a way I could reference across multiple modules.
>
> Well, thanks for your help. Hopefully I'll be able to work out some
>
Calvin Spealman wrote:
>
> Original Poster should send this off to thedailywtf.com
I absolutely agree. This is a terrible programming practice.
--
http://mail.python.org/mailman/listinfo/python-list
Paul McGuire wrote:
> If your re demands get more complicated, you could take a look at
> pyparsing. The code is a bit more verbose, but many find it easier to
> compose their expressions using pyparsing's classes, such as Literal,
> OneOrMore, Optional, etc., plus a number of built-in helper func
David E. Konerding DSD staff wrote:
> The easiest approach, though, is to use the threadedselectreactor in Twisted
> (you need
> to check the HEAD branch out with subversion, because that reactor isn't
> included in any releases).
> With threadedselectreactor, it's easy to incorporate both the GU
Ben Finney wrote:
> Once PEP 328 is fully implemented, all bare 'import foo' statements
> specify absolute imports (i.e. from sys.path only). To perform a
> relative import (e.g. from current directory) will require different
> syntax.
I'm not completely familiar with either, but how will that inf
jeff sacksteder wrote:
> Regex questions seem to be rather resistant to googling.
>
> My regex currently looks like - 'FOO:.*\n\n'
>
> The chunk of text I am attempting to locate is a line beginning with
> "FOO:", followed by an unknown number of lines, terminating with a
> blank line. Clearly th
I don't think the python regular expression module correctly handles
combining marks; it gives inconsistent results between equivalent forms
of some regular expressions:
>>> sys.version
'2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]'
>>>re.match('\w',unicodedata.normalize('NFD
Bryan Olson wrote:
>
> Thanks.
>
> Yeah, guess I was naive to test on Windows and expect that kind
> of process stuff to be portable. I'll be away from Linux for a
> week or so, so this will take me a while.
>
> Further bulletins as events warrant.
If you can get a cross-platform solution, plea
[EMAIL PROTECTED] wrote:
> i modified my C test program (included below) to explicitly set the
> default thread stack size, and i'm still running into the same
> problem. can you think of any other thing that would possibly be
> limiting me?
Hrm, you're on an A64, so that might very well mean you
[EMAIL PROTECTED] wrote:
> Are you kidding? You are going to MANDATE spaces?
Actually, future whitespace rules will be extensive. See:
http://64.233.187.104/search?q=cache:k1w9oZr767QJ:www.artima.com/weblogs/viewpost.jsp%3Fthread%3D101968
(google cache of
http://www.artima.com/weblogs/viewpost.
Michael J. Fromberger wrote:
> While I'm mildly uncomfortable with the precedent that would be set
by including the contents of "sys" as built-ins, I must confess my
objections are primarily aesthetic: I don't want to see the built-in
namespace any more cluttered than is necessary -- or at le
beza1e1 wrote:
> Well, a declarative sentence is essentially subject-predicate-object,
> while a question is predicate-subject-object. This is important in
> further processing. So perhaps i should code this order into the
> classes? I need to think a little bit more about this.
A question is subj
Chris Mellon wrote:
> functions with real names is crucial to maintainable code. The only
> reason to ever use a lamdba in Python is because you don't want to
> give a function a name, and that is just not a compelling use case for
> GUI events.
Ah, but that neglects the sheer utility of delayed-e
Gabriel Zachmann wrote:
>
> I was wondering why python doesn't contain a way to make things "const"?
>
> If it were possible to "declare" variables at the time they are bound to
> objects that they should not allow modification of the object, then we
> would have a concept _orthogonal_ to data
Antoon Pardon wrote:
> Suppose we would add type declarations in python.
> So we could do things like
>
> int: a
> object: b
>
> Some people seem to think that this would introduce static
> typing, but the only effect those staments need to have
> is that each time a variable is rebound an as
Paul McGuire wrote:
> This isn't a regex solution, but uses pyparsing instead. Pyparsing
> helps you construct recursive-descent parsers, and maintains a code
> structure that is easy to compose, read, understand, maintain, and
> remember what you did 6-months after you wrote it in the first place
Peter Otten wrote:
>
> def add_freqs3(freq1, freq2):
> total = dict(freq1)
> for key, value in freq2.iteritems():
> try:
> total[key] += value
> except KeyError:
> total[key] = value
> return total
>
Untested, but replacing the try/except pair
Diez B. Roggisch wrote:
> No. That is simply impossible in python as well as in java where functions
> are always virtual, meaning they are looked up at runtime. Because you'd
> never know _which_ code to insert of all the different foo()-methods that
> might be around there.
Not quite "simply imp
Antoon Pardon wrote:
> Op 2006-01-10, Peter Decker schreef <[EMAIL PROTECTED]>:
>>I don't see the two comparisons as equivalent at all. If two things
>>are different, it does not follow that they can be ranked.
>
>
> That a < b returns false doesn't imply that a and b can be ranked.
> take sets.
Fredrik Lundh wrote:
>>TAG.did.you.just.call.me.a.kook.questionmark
>
>
> TAG.no.dash.but.if.you.keep.replying.to.them.all.the.time.i.may.have.to.plonk.you.too.smiley
TAG.you're.it.exclamation.point.
--
http://mail.python.org/mailman/listinfo/python-list
Tim Peters wrote:>
> Probably not, if Paul's American. For example, here in the states we
> have Python Parks, where you go to look at scenery from inside your
> python.
As an American residing in Canada, I'll say that Python Parks are only
fun if they spring for hydro -- otherwise it's kind of
Claudio Grondi wrote:
> The Python tutorial '3.2 The standard type hierarchy' says:
> """
> Ellipsis: This type has a single value. There is a single object with
> this value. This object is accessed through the built-in name Ellipsis.
> It is used to indicate the presence of the "..." syntax i
Anton Vredegoor wrote:
> And pave the way for a natural language parser. Maybe there's even some
> (sketchy) path now to link computer languages and natural languages. In
> my mind Python has always been closer to human languages than other
> programming languages. From what I learned about it, lan
As a hobby project, I'm writing a MUD client -- this scratches an itch,
and is also a good excuse to become familiar with the Python language.
I have a conceptual handle on most of the implementation, but the
biggest unknown for me is the seemingly trivial matter of text display.
My first requi
Andrew Dalke wrote:
> Christopher Subich wrote:
>
>> My first requirement is raw speed; none of what I'm doing is
processing-intensive, so Python itself shouldn't be a problem here.
>
>
>
> There's raw speed and then there's raw speed. Do
Paul Rubin wrote:
> Use tkinter if you care about cross-platform operation. Everything
> else requires downloading and installing separate toolkits.
Oh, the downloading and installing isn't a big deal. If in the
far-flung future anyone else uses this program, they'll be big boys who
can ins
Peter Hansen wrote:
> I can see only one comment that seems to describe that situation,
where it refers to "IEEE 754 floating point numbers do not satisfy [==
being the complement of !=]".
>
> (Though that may be justification enough for the feature...)
To my naive eye, that possibility see
Paul Rubin wrote:
> No, it's a big pain. I'm a big boy and gave up on trying to install
> wxpython for bittorrent on FC3 (the problem was with wxwidgets needing
> an obsolete version of gtk, not with wxpython itself). There's just
> no compelling reason to want to deal with this stuff. Tkinter
[EMAIL PROTECTED] wrote:
> Hello,
>
> How do i pack different data types into a struct or an array. Examples
> would be helpful.
>
> Say i need to pack an unsigned char( 0xFF) and an long( 0x)
> into a single array? The reason i need to do this is send a packet over
> a network.
Look at
Jp Calderone wrote:
> If you like, you can check out the code:
>
> http://sourceforge.net/projects/originalgamer
>
> As MUD clients go, it's pretty weak, but it solves the text display
> problem pretty decently.
Oooh! Code! Thanks! After taking an extremely quick look, I think I
might be kicki
Tom Haddon wrote:
> Hi Folks,
>
> When I run:
>
> print "%0.2f" % ((16160698368/1024/1024/1024),)
>
> I get 15.00
>
> I should be getting 15.05. Can anyone tell me why I'm not?
Short answer: Integer division.
Long answer: Integer division.
16160698368/1024 = 15781932L
15781932L/1024 =
Paul Rubin wrote:
> We're just talking about a scrolling text window that has to run at
> human reading and typing speeds, right? It shouldn't be a problem.
> I've used the text widget and found it to be fast enough for what I
> was doing, though I didn't exactly stress it.
It should have bu
I'm building an application involving both twisted and Tkinter. Since
twisted co-opts .mainloop() in its reactor.run(), and since it
behaves very badly if the application quits without reactor.stop()
running, I attach the following function to '' in the main
window (root = Tk()):
def stop_rea
[EMAIL PROTECTED] wrote:
> Bindings created on a Toplevel or Tk widget apply to *all* widgets in
> the same toplevel. So you're seeing a event for each widget
> you create...
Oh. :) Is there a way of binding the event just to the window itself,
or should I just check that the widget referenced
Jeff Epler wrote:
> For me, an 'is' test works to find out what widget the event is taking
> place on.
... yes, I am apparently as stupid as I look. In my test code, I was
trying "if event is widget," and I just now saw that. Thanks! :)
--
http://mail.python.org/mailman/listinfo/python-list
Claudio Grondi wrote:
>> Just follow the white rabbit.
>
>
> This triggers in me the temptation to start
> a thread asking:
>
> What (in your opinion) can a good programmer
> learn from watching all of the Matrix movies?
> Which part, one, two or three deals most with
> the philosophy of
Richard Lewis wrote:
> Hi there,
>
> I've just started my first project with Tkinter.
> This set up should allow me to be able to access main.data and main.root
> from the commands.py module and the command callback functions (defined
> in commands.py) from mainwindow.py.
<...>
> Whats going wrong
Paul McGuire wrote:
> (sorry if this is a double-post - I tried posting this last night but I
> think GoogleGroups ate it)
>
> Pyparsing is a pure-Python class library for quickly and easily
> constructing recursive-descent parsers. Pyparsing takes a
> "building-block" approach to parser construc
Cameron Laird wrote:
> cleaner algorithm somewhere in the neighborhood. In general,
> "application-level" programming doesn't need exec() and such.
>
> PyPy and debugger writers and you other "systems" programmers
> already know who you are.
Out of curiosity, where would you classify interprete
101 - 157 of 157 matches
Mail list logo