On 9/26/06, Simon Brunning <[EMAIL PROTECTED]> wrote:
> On 26 Sep 2006 02:59:07 -0700, codefire <[EMAIL PROTECTED]> wrote:
> > For example isinstance(a, int) works fine but isinstance(s, string)
> > doesn't - because 'string is not known'.
>
> In this case, you want "str" rather than "string".
A c
You can parse it just once, you just have to setup your data structure
(the structure of your XML schema) and fill it up as you parse.
For example, you can represent you data structure as a dictionaries in
Python:
message={
MID : {
' timestamp' : TIMESTAMP,
codefire a écrit :
> Haha!
>
> OK thanks guys.
>
> I was just trying to check if objects were the same (object), didn't
> know Integers were a special case.
They are not a special case so much. It's just that "is" is extremly
unreliable unless you're the one who created the objects. In the case
In message <[EMAIL PROTECTED]>, Andrew McLean wrote:
> I have the ability to query a database in a legacy system and extract
> records which match a particular pattern. Specifically, I can perform
> queries for records that contain a given search term as a sub-string of
> a particular column.
Wha
Lawrence D'Oliveiro enlightened us with:
> You're proposing two separate functions:
>
> 1) quoting of non-wildcard specials
> 2) quoting of wildcard specials
I'm suggesting functions based on the role of the string they need to
escape, not the characters in that string.
1) Quoting of
Fredrik Lundh wrote:
> Sequences:
> str
> unicode
footnote: to simplify, there's also a "basestring" base class that can
be used to check for either str or unicode:
isinstance(obj, basestring)
is equivalent to
isinstance(obj, (str, unicode))
--
http://mail.python.org/m
hi
what is the python way to concat 2 lines eg
line 1 with some text
line 2 with some text
i want to bring line 2 up , such that i get one whole string.
line 1 with some text line 2 with some text
--
http://mail.python.org/mailman/listinfo/python-list
In message <[EMAIL PROTECTED]>, BerndWill wrote:
> The only solution from me and my colleagues view (as poor at it sounds)
> is to setup a little python script "pinging" an amount of about 2.000
> servers in daily intervals checking for the validity of those SSL
> certificates.
There's no need t
On 26 Sep 2006 03:16:25 -0700, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> what is the python way to concat 2 lines eg
>
> line 1 with some text
> line 2 with some text
>
> i want to bring line 2 up , such that i get one whole string.
>
> line 1 with some text line 2 with some text
line1 = "l
codefire enlightened us with:
> I'm using the isinstance built-in function. I've found the docs for
> it, but there are no docs on the supported types.
All types/classes are supported.
> For example isinstance(a, int) works fine but isinstance(s, string)
> doesn't - because 'string is not known'.
Antoine De Groote wrote:
> Thorsten Kampe wrote:
>> * John Machin (24 Sep 2006 15:32:20 -0700)
>>> Antoine De Groote wrote:
is there a python equivalent for the ruby %w operator?
%w{a b c} creates an array with strings "a", "b", and "c" in ruby...
>>> | >>> "a b c".split()
>>> | ['a'
[EMAIL PROTECTED] wrote:
> GOOGLE IS NOT OUR SUBJECT ANY MORE.
>
> MY GOAL IS NOT MAKING SEARCH ON GOOGLE:
> MY GOAL IS MAKING A SEARCH ON
> www.onelook.com, for example
this is usenet; you don't "own" the threads you start. if there's a
subthread that you don't find relevant to your original
Frederic Rentsch wrote:
> If I may add another thought along the same line: regular expressions
> seem to tend towards an art form, or an intellectual game. Many
> discussions revolving around regular expressions convey the impression
> that the challenge being pursued is finding a magic formul
[EMAIL PROTECTED] wrote:
> GOOGLE IS NOT OUR SUBJECT ANY MORE.
>
> MY GOAL IS NOT MAKING SEARCH ON GOOGLE:
> MY GOAL IS MAKING A SEARCH ON
> www.onelook.com, for example
"""
Can you send me the list of words in the index? May I extract it from your
site?
No, sorry. If you're thinking about wri
On 26 Sep 2006 02:59:07 -0700, codefire <[EMAIL PROTECTED]> wrote:
> I'm using the isinstance built-in function. I've found the docs for it,
> but there are no docs on the supported types.
>
> For example isinstance(a, int) works fine but isinstance(s, string)
> doesn't - because 'string is not kno
Jon Ribbens <[EMAIL PROTECTED]> wrote:
>In article <[EMAIL PROTECTED]>, Duncan Booth wrote:
>> I guess you've never seen anyone write tests which retrieve some generated
>> html and compare it against the expected value. If the page contains any
>> unescaped quotes then this change would break i
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Georg Brandl wrote:
>
>> Lawrence D'Oliveiro wrote:
>>> In message <[EMAIL PROTECTED]>, Max M wrote:
>>>
Lawrence is right that the escape method doesn't work the way he expects
it to.
Rewriting a library module sim
codefire wrote:
> I was just trying to check if objects were the same (object), didn't
> know Integers were a special case.
they're not, really; "is" works the same way for all objects.
when you ask for a new immutable object, a Python implementation may
always reuse an existing object, if it w
AOL^H^H^H, me too.
And it's paid better than C++ programming.
HTH,
Gerald
Gabriel Genellina schrieb:
> At Monday 25/9/2006 20:09, walterbyrd wrote:
>
> I do.
>
>> If so, I doubt there are many.
>
>
> That's why they get well paid :)
> (uhm, not really... :( )
>
>
>
> Gabriel Genellina
> So
[EMAIL PROTECTED] schrieb:
> Q: The C idea of (pv != NULL) is said most directly in Python ctypes
> how?
>
> A: We are of course supposed to write something like:
>
> def c_not_null(pv):
> return (ctypes.cast(pv, ctypes.c_void_p).value != None)
>
> Yes?
>
> Working from
[EMAIL PROTECTED] wrote:
> Frederic Rentsch wrote:
>
>> [EMAIL PROTECTED] wrote:
>>
>>> These are csound files. Csound recently added python as a scripting
>>> language and is allowing also allowing csound calls from outside of
>>> csound. The nice thing about csound is that instead of wo
In message <[EMAIL PROTECTED]>, Sybren Stuvel
wrote:
> Lawrence D'Oliveiro enlightened us with:
>> The trouble with this is that, instead of offering extra functionality,
>> it leaves the door open to making two stupid mistakes:
>>
>> 2) quoting of wildcards BEFORE quoting of non-wildcards
>
walterbyrd wrote:
> If so, I doubt there are many.
We're at least two here...
> I wonder why that is?
>
I wonder why you have such an a priori ?
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://m
George Sakkis wrote:
>
[Oslo, Norway short of 300-500 Java developers]
> Um, how many of these "lots of Java developers looking for work" live
> in, or are willing to relocate to, Oslo?
Well, I really meant to say that the "lots of Java developers" I've
seen actually are in Oslo. Certainly, ever
codefire a écrit :
> I thought the 'is' operator was used to identify identical objects,
> whereas the '==' operator checked equality. Well, I got a surprise
> here:
>
> IDLE 1.1.3
a = 10
b = a
a is b
> True
a == b
> True
c = 10
a == c
> True
a is c
> True
>
> I
codefire wrote:
> I thought the 'is' operator was used to identify identical objects,
> whereas the '==' operator checked equality. Well, I got a surprise
> here:
>
> IDLE 1.1.3
a = 10
b = a
a is b
> True
a == b
> True
c = 10
a == c
> True
a is c
> True
>
In article <[EMAIL PROTECTED]>, Steve Holden wrote:
>> I would have hoped that people don't treat that as a licence to be
>> obnoxious, though. I am aware of Fredrik's history, which is why I
>> was somewhat surprised and disappointed that he was being so rude
>> and unpleasant in this thread. He i
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, John
> Machin wrote:
>
> > 1. Reasoning: How do you get a literal "'" into an SQL string constant?
> > How do you get a literal "\" into a Python string constant? How do you
> > get a literal "$" into some *x shell command lines? Do you
In message <[EMAIL PROTECTED]>, Fredrik
Lundh wrote:
> Lawrence D'Oliveiro wrote:
>
> > SQL databases like MySQL are _designed_ for efficiency.
>
> unlike the Python data types, you mean ?
Did I say it was unlike anything?
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano a écrit :
> On Mon, 25 Sep 2006 16:11:38 +0200, Christophe wrote:
>> This is useless AND annoying at the same time.
>
> But people like us don't screw up our email address in the first place,
> and if we do, we know how to fix it. Not everybody is like us.
So you say that the bett
Lawrence D'Oliveiro wrote:
> SQL databases like MySQL are _designed_ for efficiency.
unlike the Python data types, you mean ?
--
http://mail.python.org/mailman/listinfo/python-list
In message <[EMAIL PROTECTED]>, John
Machin wrote:
> Lawrence D'Oliveiro wrote:
>> In message <[EMAIL PROTECTED]>, John
>> Machin wrote:
>>
>> > 1. Reasoning: How do you get a literal "'" into an SQL string constant?
>> > How do you get a literal "\" into a Python string constant? How do you
>> >
On 9/26/06, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
> All right, sorry, looks like they want to load the entire table into RAM and
> key it off the first field. Kind of defeats the point of having SQL, but
> there you go...
Keeping an in-memory cache of small, unchanging, frequently-read
ta
codefire wrote:
> Hi,
>
> I'm using the isinstance built-in function. I've found the docs for it,
> but there are no docs on the supported types.
It supports *all* types.
>
> For example isinstance(a, int) works fine but isinstance(s, string)
> doesn't - because 'string is not known'.
That's bec
[EMAIL PROTECTED] enlightened us with:
> hi
> what is the python way to concat 2 lines eg
concated = line1 + line2
Sybren
--
Sybren Stüvel
Stüvel IT - http://www.stuvel.eu/
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
> Unfortunately, if management goes further down the page, they find
> Ruby and "D" (when did that get out) both rated so many up arrows they
> had to use shorthand notation to represent 14 arrows...
Yes, there is no doubt Ruby is gaining traction - mostly due to t
> for dense guys like myself, regular expressions work best if you use
> them as simple tokenizers, and they suck pretty badly if you're trying
> to use them as parsers.
:) Well, I'm with you on that one Fredrik! :)
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro skrev:
> In message <[EMAIL PROTECTED]>, Gabriel G
> wrote:
>
>> At Monday 25/9/2006 11:08, Jon Ribbens wrote:
>>
> What precisely do you think it would "break"?
existing code, and existing tests.
>>> I'm sorry, that's not good enough. How, precisely, would it break
>>
> I still don't touch regular expressions... They may be fast, but to
> me they are just as much line noise as PERL... I can usually code a
> partial "parser" faster than try to figure out an RE.
Yes, it seems to me that REs are a bit "hit and miss" - the only way to
tell if you've got a RE "righ
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
> In message <[EMAIL PROTECTED]>, Duncan Booth wrote:
>
>> The spurious escaping of the apostrophe does no harm, but spuriously
>> escaping a newline makes the select match the letter 'n' insteal of
>> matching a newline.
>
> And how would you get m
walterbyrd wrote:
> If so, I doubt there are many.
My share of the waterfall :o)
I do earn my (preposterously nice *wink*) salary from doing *all* major
efforts, at the company I work for, in Python.
Not only that, since I started out here some 5 years ago, nearly all
software development of
Lawrence D'Oliveiro enlightened us with:
> The trouble with this is that, instead of offering extra functionality, it
> leaves the door open to making two stupid mistakes:
>
> 2) quoting of wildcards BEFORE quoting of non-wildcards
Why is this a "stupid" mistake in your view? Please explain th
In message <[EMAIL PROTECTED]>, John
Machin wrote:
> 1. Reasoning: How do you get a literal "'" into an SQL string constant?
> How do you get a literal "\" into a Python string constant? How do you
> get a literal "$" into some *x shell command lines? Do you detect a
> pattern?
None of which appl
> Besides, what is so special with electronic forms that we have to go
> through all kind of tricks to make sure the user doesn't make mistakes
> when regular paper forms just assume the user will be careful when he
> fills it? Must be some kind of IQ draining field emited by all the
> computers wh
Sybren Stuvel wrote:
> I'm suggesting functions based on the role of the string they need to
> escape, not the characters in that string.
>
> 1) Quoting of wildcard strings for a query using LIKE etc.
> 2) Quoting of values for putting into queries.
it's actually quite amusing that some
Dennis Lee Bieber wrote:
> On 25 Sep 2006 10:25:01 -0700, "codefire" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>> Yes, I didn't make it clear in my original post - the purpose of the
>> code was to learn something about regexps (I only started coding Python
>> last w
Hi there !
I'm pleased to announce the 0.16.1 release of Logilab astng package.
This release include some major bug fixes (pylint crashs, 2.5 compatibility)
and have tests passing from python 2.3 to python 2.5 :). You're higly encouraged
to upgrade if you're currently using the 0.16.0 release.
W
In message <[EMAIL PROTECTED]>, Dan
Bishop wrote:
> Lawrence D'Oliveiro wrote:
>> In message <[EMAIL PROTECTED]>, Fredrik
>> Lundh wrote:
>>
>> > Max M wrote:
>> >
>> >> It also makes the escaped html harder to read for standard cases.
>> >
>> > and slows things down a bit.
>> >
>> > (cgi.escape(
GOOGLE IS NOT OUR SUBJECT ANY MORE.
MY GOAL IS NOT MAKING SEARCH ON GOOGLE:
MY GOAL IS MAKING A SEARCH ON
www.onelook.com, for example
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro wrote:
> What other kind of mapping could you produce?
and here we go again. how about reading the code the OP posted, or the
first few followups?
--
http://mail.python.org/mailman/listinfo/python-list
I thought the 'is' operator was used to identify identical objects,
whereas the '==' operator checked equality. Well, I got a surprise
here:
IDLE 1.1.3
>>> a = 10
>>> b = a
>>> a is b
True
>>> a == b
True
>>> c = 10
>>> a == c
True
>>> a is c
True
>>>
I was NOT expecting the last statement to ret
In message <[EMAIL PROTECTED]>, Fredrik
Lundh wrote:
> Lawrence D'Oliveiro wrote:
>
> > Kind of defeats the point of having SQL, but there you go...
>
> there are plenty of reasons to use Python data structures instead of the
> SQL engine for data crunching. especially if you care about effici
abcd enlightened us with:
> Any suggestions on how to find out? I did try adding to MyFile
>
> def __call__(self, *args):
> print "calling:", args
> return file.__call__(self, *args)
>
> but I never see that either.
I don't know the answer to your problem, but I can explain why this
d
Of course you can always use grep as an external process (if the OS has
it). For example:
---
In [1]: import subprocess
In [2]: out=subprocess.Popen( 'grep -i blah ./tmp/*',
stdout=subprocess.PIPE, shell=True ).communicate()[0]
In [
In message <[EMAIL PROTECTED]>, Duncan Booth wrote:
> The spurious escaping of the apostrophe does no harm, but spuriously
> escaping a newline makes the select match the letter 'n' insteal of
> matching a newline.
And how would you get my QuoteSQL routine, as written, to make the same
mistake yo
Ilias Lazaridis wrote:
> Ilias Lazaridis wrote:
>> IDLE has an output format like this:
>>
>> >>> object
>>
>> >>> type
>>
>> >>> object.__class__
>>
>> >>> object.__bases__
>>
>> How can I customize it to become like that:
>>
>> >>> object
>>
>> >>> type
>>
>> >>> object.__cl
At Monday 25/9/2006 20:09, walterbyrd wrote:
I do.
If so, I doubt there are many.
That's why they get well paid :)
(uhm, not really... :( )
Gabriel Genellina
Softlab SRL
__
Preguntá. Respondé. Descubrí.
Hi,
2006/9/25, Fredrik Lundh <[EMAIL PROTECTED]>:
> I don't have time to dig deeper into this right now, but this post might
> be helpful:
>
> http://article.gmane.org/gmane.comp.python.general/471411
I tried to override the "verify_request" method, it managed to get the
ClientAddress, but in
Juju wrote:
> But I still have a little question :
>
> How can I do to know which method I should override to make the things work ?
>
> Usually, I look at "python.org" but in this case, I couldn't find what
> I was looking for. Finally, I had to look at the source files to under-
> stand what
Aahz enlightened us with:
> Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>>
>>well, if you're only watching mtv, it's easy to think that there's
>>obviously not much demand for country singers, blues musicians,
>>British hard rock bands, or melodic death metal acts.
>
> Any other votes for this being
At Monday 25/9/2006 09:02, billie wrote:
Hi all. I know that it's possible to automatically run a Python program
in background by giving it the "pyw" extension.
This is useful when I release a source ditribution of my program.
How could it be possible to do the same thing with an .exe file
compi
Lawrence D'Oliveiro wrote:
> Kind of defeats the point of having SQL, but there you go...
there are plenty of reasons to use Python data structures instead of the
SQL engine for data crunching. especially if you care about efficiency.
--
http://mail.python.org/mailman/listinfo/python-list
In message <[EMAIL PROTECTED]>, Georg Brandl wrote:
> Lawrence D'Oliveiro wrote:
>> In message <[EMAIL PROTECTED]>, Max M wrote:
>>
>>> Lawrence is right that the escape method doesn't work the way he expects
>>> it to.
>>>
>>> Rewriting a library module simply because a developer is surprised i
In message <[EMAIL PROTECTED]>, Gabriel G
wrote:
> At Monday 25/9/2006 11:08, Jon Ribbens wrote:
>
>> >> What precisely do you think it would "break"?
>> >
>> > existing code, and existing tests.
>>
>>I'm sorry, that's not good enough. How, precisely, would it break
>>"existing code"? Can you com
In message <[EMAIL PROTECTED]>, Georg Brandl wrote:
> Lawrence D'Oliveiro wrote:
>> In message <[EMAIL PROTECTED]>, Fredrik
>> Lundh wrote:
>>
>>> Lawrence D'Oliveiro wrote:
>>>
> Georg Brandl wrote:
>
>> A function is broken if its implementation doesn't match the
>> documentati
hehe i saw that,that is what made my understand it.
the decorator now works.
let say i have a function decorated with two decorators:
@Accept(int,int)
@OtherDecorator
def myfunc(a,b):
pass
how can i make the two decorators into one(note:one get parameters and
the other doesn`t)
--
http://ma
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Fredrik
> Lundh wrote:
>
>> Lawrence D'Oliveiro wrote:
>>
Georg Brandl wrote:
> A function is broken if its implementation doesn't match the
> documentation.
or if it doesn't match the designer's intent. cgi
In message <[EMAIL PROTECTED]>, Steve
Holden wrote:
> Lawrence D'Oliveiro wrote:
>>
>> In message <[EMAIL PROTECTED]>, Steve
>> Holden wrote:
>>
>>
>>>When you use the DB API correctly and paramterise your queries you still
>>>need to quote wildcards in search arguments, but you absolutely
>>>sh
Steven D'Aprano wrote:
> On Mon, 25 Sep 2006 13:51:55 +0200, Fredrik Lundh wrote:
>
>
>>http://www.google.com/terms_of_service.html
>>
>>"You may not send automated queries of any sort to Google's system
>> without express
>>permission in advance from Google."
>
>
> I'm not just be
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Max M wrote:
>
>> Lawrence is right that the escape method doesn't work the way he expects
>> it to.
>>
>> Rewriting a library module simply because a developer is surprised is a
>> *very* bad idea.
>
> I'm not surprised. Disappointed,
Steve Holden wrote:
> Ah, so your quoting function will deduce the context in which arguments
> intended for parameter substitution in the query will be used? Or are
> you suggesting that it's unwise to rely on autoquoted parameters? That
> could have a serious impact on the efficiency of some
Steven D'Aprano wrote:
> Google don't define "automated query"it, and I don't think they can.
the phrases they use are well understood in the SE business. that's
good enough for everyone involved (including courts; see below).
> (What on earth is "meta-searching"? If you're going to use terms
> well, if you're only watching mtv, it's easy to think that there's
> obviously not much demand for country singers, blues musicians, British
> hard rock bands, or melodic death metal acts.
These days its even hard to get the idea that there is a demand of boy
bands, rnb, euro trash or any oth
In message <[EMAIL PROTECTED]>, I wrote:
> In message <[EMAIL PROTECTED]>, Fredrik
> Lundh wrote:
>
>> Lawrence D'Oliveiro wrote:
>>
>>> yield dict(zip(Fields, NextRow))
>>
>> the OP didn't ask for a field name => value mapping, though.
>
> What other kind of mapping could you produce?
Jon Ribbens wrote:
> In article <[EMAIL PROTECTED]>, Brian Quinlan wrote:
>> A summary of this pointless argument:
>
> Your summary seems pretty reasonable, but please note that later on,
> the thread was not about cgi.escape escaping (or not) quote
> characters (as described in your summary), but
Frank Millman wrote:
> Fredrik Lundh wrote:
>
>>Frank Millman wrote:
>>
>>
>>>I am reminded of a spoof Latin motto from the days of my youth -
>>>
>>> NIL ILLEGITIMO CARBORUNDUM
>>
>>isn't that usually written
>>
>>Illegitimi non carborundum
>>
>>?
>>
>>or is that just due to differences bet
Lawrence D'Oliveiro wrote:
> Fredrik Lundh wrote:
> > you're not the designer...
>
> I don't have to be. Whoever the designer was, they had not properly thought
> through the uses of this function. That's quite obvious already, to anybody
> who works with HTML a lot. So the function is broken and
Paul Rubin wrote:
> Brian Quinlan <[EMAIL PROTECTED]> writes:
>> o cgi.escape is not meant for serious web application development,
>
> What is it meant for then? Why should the library ever implement
> anything in a half-assed way unsuitable for serious application
> development, if it can suppl
abcd wrote:
> Any ideas what methods the stdout (and I guess stderr) of Popen objects
> from subprocess call?
the external process only sees OS-level file handles (the number you get
from the fileno() method on your file objects), not Python objects. no
matter how you override things in your p
In message <[EMAIL PROTECTED]>, Fredrik
Lundh wrote:
> Lawrence D'Oliveiro wrote:
>
>> yield dict(zip(Fields, NextRow))
>
> the OP didn't ask for a field name => value mapping, though.
What other kind of mapping could you produce?
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
> In message <[EMAIL PROTECTED]>, Duncan Booth
> wrote:
>
>> If I have a unicode string such as: u'\u201d' (right double quote),
>> then I want that encoded in my html as '”' (or ” but the
>> numeric form is better).
>
> Right-double-quote is not a
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
>> (cgi.escape(s, True) is slower than cgi.escape(s), for reasons that
>> are obvious for anyone who's looked at the code).
>
> What you're doing is adding to the reasons why the existing cgi.escape
> function is stupidly designed and implemented. Th
At Monday 25/9/2006 21:58, urielka wrote:
i think i got what the * and ** mean.
*args mean arguments that are assigned by position(that is why *arg is
a tuple)
**kwds mean arguments that are assigned using equals a=2,b=3 (that is
why **kwds i a dict)
but why self is in *args and other thing goes
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Fredrik
> Lundh wrote:
>
> > Max M wrote:
> >
> >> It also makes the escaped html harder to read for standard cases.
> >
> > and slows things down a bit.
> >
> > (cgi.escape(s, True) is slower than cgi.escape(s), for reasons that are
> >
301 - 384 of 384 matches
Mail list logo