Steven D'Aprano wrote:
On Fri, 02 Apr 2010 19:48:59 -0700, Ethan Furman wrote:
The heuristic I use is, if I expect the try block to raise an exception
more than about one time in ten, I change to an explicit test. In this
case, since the exception should only be raised once, and then never
aga
"Booter" wrote in message
news:ec6d247c-a6b0-4f33-a36b-1d33eace6...@k19g2000yqn.googlegroups.com...
Hello all,
I am new to python ans was wondering if there was a way to get the mac
address from the local NIC?
Thanks for your help.
Gerad
This is what I use -
def
On Fri, 02 Apr 2010 19:48:59 -0700, Ethan Furman wrote:
>> The heuristic I use is, if I expect the try block to raise an exception
>> more than about one time in ten, I change to an explicit test. In this
>> case, since the exception should only be raised once, and then never
>> again, I would use
"jobs in alaska" "jobs in alaska for foreigners" "jobs in alaska oil"
"jobs in alaska for women" "alaska jobs" "alaska jobs north slope"
"alaska jobs pipeline" "alaska jobs for foreigners" ON
http://jobsinalaska-usa.blogspot.com/ "jobs in alaska"
"jobs in alaska for foreigners" "job
On Apr 2, 10:11 pm, Stephen Hansen wrote:
>
> I don't know if properties are really faster or slower then a
> __getattr__, but I find them a lot cleaner if I want to delay some
> calculation until needed like that.
Well, the relative speed of properties vs. __getattr__ can become
irrelevant in at
On Apr 2, 5:53 pm, Steven D'Aprano wrote:
>
> As I've pointed out before, it is natural syntax in English. Not
> necessarily the most common, but common enough to be completely
> unexceptional:
>
> "I'll be there in ten minutes, if I can find a parking space close by,
> otherwise you should start
Well, it's been said than imitation is the sincerest form of flattery,
so be flattered, Michele!
In order to gain a better understanding of the whole metaclass issue, I
decided to make my own implementation, targeting Python 3. I figured I
could leave out a bunch of the complexity required to
On 2010-04-02 19:42:29 -0700, Ethan Furman said:
Terry Reedy wrote:
In Duncan
Booth writes:
class Spam(object):
mongo = None
def __call__(self, x, y, z):
if self.mongo is None:
self.mongo = heavy_lifting_at_runtime()
return frobnicate(x, y, z, self.mongo)
Unless one wants the intializat
Steven D'Aprano wrote:
On Fri, 02 Apr 2010 12:39:16 -0700, Patrick Maupin wrote:
On Apr 2, 2:38 pm, Ethan Furman wrote:
[...]
Sounds like a personal preference issue, rather than a necessary /
unnecessary issue -- after all, if you call that function a thousand
times, only once is mongo n
Terry Reedy wrote:
In Duncan
Booth writes:
class Spam(object):
mongo = None
def __call__(self, x, y, z):
if self.mongo is None:
self.mongo = heavy_lifting_at_runtime()
return frobnicate(x, y, z, self.mongo)
Unless one wants the intialization of mongo delayed
mrdrew wrote:
> Hey all,
>
> Right now I'm completely unable to pass parameters to queries under
> any circumstances. I've got a fairly trivial query as a test...
>
> c.execute('SELECT * FROM %(table_name)s LIMIT 1',
> {'table_name':"mytable"})
>
> It fails, giving the error message...
>
> Tra
On Apr 2, 8:29 pm, Mensanator wrote:
> Don't you know how Usenet works?
No, but my cat does.
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
I think that you're confusing Python's string formatting with
SQL placeholders.
The "%(table_name)s" works only with Python's '%' operator.
You should use only the "%s" form (or possibly "?", I'm not
sure which!)
It varies depending on your DB driver. Check out the .paramstyle
On 4/2/2010 1:28 PM, Paul McGuire wrote:
On Apr 1, 5:34 pm, kj wrote:
When coding C I have often found static local variables useful for
doing once-only run-time initializations. For example:
Here is a decorator to make a function self-aware, giving it a "this"
variable that points to itsel
On 4/2/2010 6:59 PM, kj wrote:
In Duncan
Booth writes:
class Spam(object):
mongo = None
def __call__(self, x, y, z):
if self.mongo is None:
self.mongo = heavy_lifting_at_runtime()
return frobnicate(x, y, z, self.mongo)
Unless one wants the intialization of mo
On Apr 2, 7:32 pm, Patrick Maupin wrote:
> On Apr 2, 6:50 pm, Mensanator wrote:
>
> > On Apr 2, 2:34 pm, Patrick Maupin wrote:
>
> > > Methinks the OP is fluent in the way of choosing newsgroups.
> > > According to google, he has posted 6855 messages in 213 groups.
>
> > Does that really mean an
mrdrew wrote:
Hey all,
Right now I'm completely unable to pass parameters to queries under
any circumstances. I've got a fairly trivial query as a test...
c.execute('SELECT * FROM %(table_name)s LIMIT 1',
{'table_name':"mytable"})
It fails, giving the error message...
Traceback (most recent
On Fri, 02 Apr 2010 20:12:59 +, kj wrote:
> In Steve Holden
> writes:
[...]
>>Yes, that's deliberately awful syntax. Guido designed it that way to
>>ensure that people didn't aver-use it, thereby reducing the readability
>>of Python applications.
>
> Is that for real??? It's the QWERTY rat
On Apr 2, 6:50 pm, Mensanator wrote:
> On Apr 2, 2:34 pm, Patrick Maupin wrote:
>
> > Methinks the OP is fluent in the way of choosing newsgroups.
> > According to google, he has posted 6855 messages in 213 groups.
>
> Does that really mean anything? Hell, I have 12765 messages
> posted to 332 gr
Hey all,
Right now I'm completely unable to pass parameters to queries under
any circumstances. I've got a fairly trivial query as a test...
c.execute('SELECT * FROM %(table_name)s LIMIT 1',
{'table_name':"mytable"})
It fails, giving the error message...
Traceback (most recent call last):
Fi
On Apr 2, 6:57 pm, Steven D'Aprano wrote:
> On Fri, 02 Apr 2010 12:39:16 -0700, Patrick Maupin wrote:
> > On Apr 2, 2:38 pm, Ethan Furman wrote:
> [...]
> >> Sounds like a personal preference issue, rather than a necessary /
> >> unnecessary issue -- after all, if you call that function a thousan
On Fri, 02 Apr 2010 12:39:16 -0700, Patrick Maupin wrote:
> On Apr 2, 2:38 pm, Ethan Furman wrote:
[...]
>> Sounds like a personal preference issue, rather than a necessary /
>> unnecessary issue -- after all, if you call that function a thousand
>> times, only once is mongo not defined... clearl
On Apr 2, 2:34 pm, Patrick Maupin wrote:
> On Apr 2, 2:41 pm, Andreas Waldenburger
> wrote:
>
> > While everyone else is mocking you: Can you please elaborate on why you
> > want to know and what kind of problem you're trying to solve with this?
> > Also, don't you think you should have picked a
On Apr 2, 6:07 pm, Steven D'Aprano wrote:
> On Fri, 02 Apr 2010 12:35:55 -0700, Mensanator wrote:
> >> If you want an exact result when multiplying arbitrary fractions, you
> >> need to avoid floats and decimals and use Fractions:
>
> >> >>> Fraction(1, 2)**2
>
> >> Fraction(1, 4)
>
> > Where do y
Thanks everyone, the invRegexInf is perfect.
Thanks again,
Nathan
On 1 April 2010 10:17, Gabriel Genellina wrote:
> En Wed, 31 Mar 2010 12:23:48 -0300, Paul McGuire
> escribió:
>>
>> On Mar 31, 5:49 am, Nathan Harmston
>> wrote:
>>>
>>> I have a slightly complicated/medium sized regular expre
On Fri, 02 Apr 2010 12:35:55 -0700, Mensanator wrote:
>> If you want an exact result when multiplying arbitrary fractions, you
>> need to avoid floats and decimals and use Fractions:
>>
>> >>> Fraction(1, 2)**2
>>
>> Fraction(1, 4)
>
> Where do you get that from?
Where do I get what from? Fracti
In Duncan Booth
writes:
>class Spam(object):
> mongo = None
> def __call__(self, x, y, z):
> if self.mongo is None:
> self.mongo = heavy_lifting_at_runtime()
> return frobnicate(x, y, z, self.mongo)
>spam = Spam()
>ham = spam(1, 2, 3)
I really like this. Thanks.
>T
On Apr 2, 4:32 pm, Peter Otten <__pete...@web.de> wrote:
> _split = re.compile(r"(\d+)").split
> def split(s):
> if not s:
> return ()
> parts = _split(s)
> parts[1::2] = map(int, parts[1::2])
> if parts[-1] == "":
> del parts[-1]
> if parts[0] == "":
>
Booter wrote:
> Hello all,
>
> I am new to python ans was wondering if there was a way to get the mac
> address from the local NIC?
>
> Thanks for your help.
>
>>> import uuid
>>> uuid.getnode()
246090452741227L
>>>
This is supposed to return the MAC address, but I am not sure it does.
The docu
Mensanator wrote:
On Apr 1, 9:44 pm, Steven D'Aprano wrote:
1/2.0
0.25
If you want an exact result when multiplying arbitrary fractions, you
need to avoid floats and decimals and use Fractions:
Fraction(1, 2)**2
Fraction(1, 4)
Where do you get that
On 04/02/2010 02:14 PM, Booter wrote:
> I am new to python ans was wondering if there was a way to get the mac
> address from the local NIC?
As Dan has indicated, you have to Popen an external command to get this
information. Every OS has different commands and syntaxes for this.
You'll have to h
On 04/02/2010 03:30 PM, Dan McLeran wrote:
> i'm running python 2.6 on win xp sp3 and i get:
Your code isn't portable to non-Windows OS's. On my Mac and on my Linux
workstations it simply doesn't work. Using '/usr/sbin/ifconfig' as the
executable name in Popen does work, however.
The OP didn't
Thomas Heller wrote:
> Thanks to all for these code snippets. Peter's solution is the winner -
> most elegant and also the fastest. With an additional list comprehension
> to remove the possible empty strings at the start and at the end I get
> 16 us. Interesting is that Xavier's solution (whic
On Apr 2, 2:52 pm, "danmcle...@yahoo.com"
wrote:
> On Apr 2, 2:14 pm, Booter wrote:
>
> > Hello all,
>
> > I am new to python ans was wondering if there was a way to get the mac
> > address from the local NIC?
>
> > Thanks for your help.
>
> > Gerad
>
> for windows parse p.stdout.read():
>
> impo
On 2-4-2010 22:55, danmcle...@yahoo.com wrote:
On Apr 2, 2:52 pm, "danmcle...@yahoo.com"
wrote:
On Apr 2, 2:14 pm, Booter wrote:
Hello all,
I am new to python ans was wondering if there was a way to get the mac
address from the local NIC?
Thanks for your help.
Gerad
for windows par
On Apr 2, 2:52 pm, "danmcle...@yahoo.com"
wrote:
> On Apr 2, 2:14 pm, Booter wrote:
>
> > Hello all,
>
> > I am new to python ans was wondering if there was a way to get the mac
> > address from the local NIC?
>
> > Thanks for your help.
>
> > Gerad
>
> for windows parse p.stdout.read():
>
> impo
On Apr 2, 2:14 pm, Booter wrote:
> Hello all,
>
> I am new to python ans was wondering if there was a way to get the mac
> address from the local NIC?
>
> Thanks for your help.
>
> Gerad
for windows parse p.stdout.read():
import subprocess
p = subprocess.Popen('ipconfig', shell = True, stdout =
On 2010-04-02 13:08:00 -0700, Christopher Roach said:
I have a script that I am working on to process a bunch of data. A
good portion of the Tk-based GUI is driven by a large set of YAML data
and I'd love to store that data inside of the script so that I can
send just a single file to my colleag
On Apr 2, 3:12 pm, kj wrote:
> Is that for real??? It's the QWERTY rationale all over again. Swell.
Well, bearing in mind that everybody seems to have an agenda, so you
can't (or shouldn't, anyway) take all your news from a single source,
it may be that the common wisdom about the QWERTY thing
kj wrote:
In Steve Holden
writes:
John Nagle wrote:
Chris Rebert wrote:
On Tue, Mar 30, 2010 at 8:40 AM, gentlestone
wrote:
Hi, how can I write the popular C/JAVA syntax in Python?
Java example:
return (a==b) ? 'Yes' : 'No'
My first idea is:
return ('No','Yes')[bool(a==b)]
Is th
Christopher Roach wrote:
> I have a script that I am working on to process a bunch of data. A
> good portion of the Tk-based GUI is driven by a large set of YAML data
> and I'd love to store that data inside of the script so that I can
> send just a single file to my colleague. Ruby has a mechanism
On Apr 2, 3:33 pm, Ethan Furman wrote:
> My main point, though, was using __call__, and not some weird _ method. ;)
Yes, __call__ is good. In general, not naming things that don't need
to be named is good (but if you have too many of them to keep track
of, then, obviously, they need to be named
kj wrote:
> In Steve Holden
> writes:
>
>> John Nagle wrote:
>>> Chris Rebert wrote:
On Tue, Mar 30, 2010 at 8:40 AM, gentlestone
wrote:
> Hi, how can I write the popular C/JAVA syntax in Python?
>
> Java example:
>return (a==b) ? 'Yes' : 'No'
>
> My first
Patrick Maupin wrote:
[snippage]
Well, I think the whole discussion has basically been about personal
preference. OTOH, but if you call the function a few million times,
you might find the cost of try/except to be something that you would
rather not incur -- it might become a performance issue
kj writes:
> Anyway, I don't know of any other language that puts the test
> between the alternatives. No doubt there's one out there, with
> emphasis on "out there"...
Perl has something that has IMO somewhat the same problem:
print "Hello, world!\n" if $some_condition;
I prefer most of the
Hello all,
I am new to python ans was wondering if there was a way to get the mac
address from the local NIC?
Thanks for your help.
Gerad
--
http://mail.python.org/mailman/listinfo/python-list
In Steve Holden
writes:
>John Nagle wrote:
>> Chris Rebert wrote:
>>> On Tue, Mar 30, 2010 at 8:40 AM, gentlestone
>>> wrote:
Hi, how can I write the popular C/JAVA syntax in Python?
Java example:
return (a==b) ? 'Yes' : 'No'
My first idea is:
return ('
I have a script that I am working on to process a bunch of data. A
good portion of the Tk-based GUI is driven by a large set of YAML data
and I'd love to store that data inside of the script so that I can
send just a single file to my colleague. Ruby has a mechanism for
doing this whereby I can loa
Patrick Maupin schrieb:
> On Apr 2, 6:24 am, Peter Otten <__pete...@web.de> wrote:
>> Thomas Heller wrote:
>> > Maybe I'm just lazy, but what is the fastest way to convert a string
>> > into a tuple containing character sequences and integer numbers, like
>> > this:
>>
>> > 'si_pos_99_rep_1_0.ita'
On Apr 2, 2:38 pm, Ethan Furman wrote:
> Patrick Maupin wrote:
> > On Apr 2, 1:21 pm, Ethan Furman wrote:
> >> For this type of situation, my preference would be:
>
> >> class spam(object):
> >> def __call__(self, x, y, z):
> >> try:
> >> mongo = self.mongo
> >>
On Apr 1, 9:44 pm, Steven D'Aprano wrote:
> On Thu, 01 Apr 2010 19:49:43 -0500, Tim Chase wrote:
> > David Robinow wrote:
> >> $ python -c "print 1/2 * 1/2"
> >> 0
>
> >> But that's not what I learned in grade school.
> >> (Maybe I should upgrade to 3.1?)
>
> > That's because you need to promote
On Apr 2, 2:41 pm, Andreas Waldenburger
wrote:
> While everyone else is mocking you: Can you please elaborate on why you
> want to know and what kind of problem you're trying to solve with this?
> Also, don't you think you should have picked a maths forum for this
> kind of question?
Methinks th
Patrick Maupin wrote:
On Apr 2, 1:21 pm, Ethan Furman wrote:
For this type of situation, my preference would be:
class spam(object):
def __call__(self, x, y, z):
try:
mongo = self.mongo
except AttributeError:
mongo = self.mongo = heavy_lifting_a
"danmcle...@yahoo.com" writes:
> On Apr 2, 11:23 am, Chris Rebert wrote:
>> On Fri, Apr 2, 2010 at 10:09 AM, danmcle...@yahoo.com
>>
>> wrote:
>> > On Apr 1, 5:54 pm, Chris Rebert wrote:
>> >> On Thu, Apr 1, 2010 at 4:46 PM, Krister Svanlund
>> >> wrote:
>> >> > On Fri, Apr 2, 2010 at 1:36 AM
Bruno Desthuilliers wrote:
And now for the most import point: __getattr__ is only called as a
*last* resort. That is, after the attribute lookup mechanism will have
tried *and failed* to find the name in the instance's __dict__.
In general, "getattr" is for unusual situations only.
If you w
purple wrote:
> On 4/2/2010 7:36 AM, Chip Eastham wrote:
>> On Apr 2, 6:14 am, A Serious Moment
>> cross-posted
>> an OCR'd version of a 1980 paper
>> by SR Mahaney, mutilating the text
>> further to remove its attribution
>> and create the false impression of
>> authorship by the (im)poster.
>
On Thu, 01 Apr 2010 22:44:51 +0200 superpollo
wrote:
> how much is one half times one half?
While everyone else is mocking you: Can you please elaborate on why you
want to know and what kind of problem you're trying to solve with this?
Also, don't you think you should have picked a maths forum f
On Fri, 02 Apr 2010 16:08:42 +, kj wrote:
> Other responses advocated for global variables. I avoid them in
> general,
In general this is wise, but remember that because Python globals are not
globally global, but local to a single module, they're safer than globals
in other languages. St
On Apr 2, 1:21 pm, Ethan Furman wrote:
> For this type of situation, my preference would be:
>
> class spam(object):
> def __call__(self, x, y, z):
> try:
> mongo = self.mongo
> except AttributeError:
> mongo = self.mongo = heavy_lifting_at_runtime(
Steve Holden wrote:
Alf P. Steinbach wrote:
* Jason Friedman:
Hi, what is the difference between:
def MyClass(object):
pass
and
def MyClass():
pass
If you really meant 'def', then the first is a routine taking one
argument, and the second is a routine of no arguments.
If you meant
Dear Colleague,
We are pleased to announce the TMSi2010 – 6th International Conference
on Technology and Medical Sciences (www.fe.up.pt/tmsi2010) that will
be held at the Faculty of Engineering of University of Porto, Porto,
Portugal, on October 21-23, 2010.
Possible Topics (but not limited to)
kj wrote:
class _Spam(object):
@classmethod
def _(cls, x, y, z):
try:
mongo = cls.mongo
except AttributeError:
mongo = cls.mongo = heavy_lifting_at_runtime()
return frobnicate(x, y, z, mongo)
ham = _Spam._(1, 2, 3)
Is this really more n
"JOBS IN ALABAMA" "ALABAMA JOBS" "ACCOUNTS JOBS IN ALABAMA" "FINANCE
JOBS IN ALABAMA" ON http://jobsinalabama-usa.blogspot.com/ "USA
JOBS" "JOBS IN USA" "JOBS IN USA STATES" "MEDICAL JOBS IN
ALABAMA""JOBS IN ALABAMA" "ALABAMA JOBS" "ACCOUNTS JOBS IN ALABAMA"
"FINANCE JOBS IN ALABAMA" ON http://
kj wrote:
> I suppose one could refactor this:
>
>
> def spam(x, y, z):
> try:
> mongo = spam.mongo
> except AttributeError:
> mongo = spam.mongo = heavy_lifting_at_runtime()
> return frobnicate(x, y, z, mongo)
>
> ham = spam(3, 4, 5)
>
>
> into this:
>
>
> class
kj wrote:
> In Steve Holden
> writes:
>
>>But the real problem is that the OP is insisting on using purely
>>procedural Python when the problem is screaming for an object-oriented
>>answer.
>
> My initial reaction to this comment was something like "What? switch
> from procedural to OO just to
On Apr 1, 5:34 pm, kj wrote:
> When coding C I have often found static local variables useful for
> doing once-only run-time initializations. For example:
>
Here is a decorator to make a function self-aware, giving it a "this"
variable that points to itself, which you could then initialize from
On Apr 2, 11:23 am, Chris Rebert wrote:
> On Fri, Apr 2, 2010 at 10:09 AM, danmcle...@yahoo.com
>
> wrote:
> > On Apr 1, 5:54 pm, Chris Rebert wrote:
> >> On Thu, Apr 1, 2010 at 4:46 PM, Krister Svanlund
> >> wrote:
> >> > On Fri, Apr 2, 2010 at 1:36 AM, Spencer
> >> > wrote:
> >> >> Is there
On Fri, Apr 2, 2010 at 10:09 AM, danmcle...@yahoo.com
wrote:
> On Apr 1, 5:54 pm, Chris Rebert wrote:
>> On Thu, Apr 1, 2010 at 4:46 PM, Krister Svanlund
>> wrote:
>> > On Fri, Apr 2, 2010 at 1:36 AM, Spencer wrote:
>> >> Is there a way to developing a script on linux and give it
>> >> to someo
On Apr 2, 11:09 am, "danmcle...@yahoo.com"
wrote:
> On Apr 1, 5:54 pm, Chris Rebert wrote:
>
>
>
> > On Thu, Apr 1, 2010 at 4:46 PM, Krister Svanlund
>
> > wrote:
> > > On Fri, Apr 2, 2010 at 1:36 AM, Spencer wrote:
> > >> Is there a way to developing a script on linux and give it
> > >> to som
On Apr 1, 5:54 pm, Chris Rebert wrote:
> On Thu, Apr 1, 2010 at 4:46 PM, Krister Svanlund
>
> wrote:
> > On Fri, Apr 2, 2010 at 1:36 AM, Spencer wrote:
> >> Is there a way to developing a script on linux and give it
> >> to someone on microsoft, so that they could run it on microsoft
> >> withou
On Apr 2, 3:19 am, Gary Herron wrote:
> Xavier Ho wrote:
> > Javascript in recent years has been getting better and better, and
>
> > now is a way better language than python. So to keep up with the
> > times pygame has been rewritten for javascript.
>
> > *shudders*
>
> > Can someone c
On Fri, Apr 2, 2010 at 1:23 AM, Xavier Ho wrote:
> On Fri, Apr 2, 2010 at 6:19 PM, Gary Herron wrote:
>> It's a joke -- see http://en.wikipedia.org/wiki/April_Fools%27_Da
>
> D'oh!
>
> Can't believe that got me.
>
> (It's already 2nd of April... you're not supposed to make that joke now! =p)
He'
In Steve Holden
writes:
>But the real problem is that the OP is insisting on using purely
>procedural Python when the problem is screaming for an object-oriented
>answer.
My initial reaction to this comment was something like "What? switch
from procedural to OO just to be able to do some one-t
On Fri, Apr 2, 2010 at 11:35 AM, A Serious Moment
wrote:
>
Do you really not see the complete absurdity of posting an entire paper in
this forum as plain text? Not only are you completely off-topic for this
group, but the paper as you posted it is completely unreadable; regardless
of whether i
On Fri, 02 Apr 2010 07:05:49 -0700, Steve Howell wrote:
>> How is the ternary operator "not really ternary, it's binary"? It
>> requires three arguments, not two, which makes it ternary. In Python
>> syntax:
>>
> Of course, I understand that the ternary operator has three arguments,
> but it only
On 4/2/2010 7:36 AM, Chip Eastham wrote:
On Apr 2, 6:14 am, A Serious Moment
cross-posted
an OCR'd version of a 1980 paper
by SR Mahaney, mutilating the text
further to remove its attribution
and create the false impression of
authorship by the (im)poster.
You report, we decide? Fox News has
I don't know how fast this is (Python 2.x):
>>> from itertools import groupby
>>> t = 'si_pos_99_rep_1_0.ita'
>>> tuple(int("".join(g)) if h else "".join(g) for h,g in groupby(t,
>>> str.isdigit))
('si_pos_', 99, '_rep_', 1, '_', 0, '.ita')
It doesn't work with unicode strings.
Bye,
bearophile
On Apr 2, 5:36 am, Chip Eastham wrote:
> On Apr 2, 6:14 am, A Serious Moment
> cross-posted
> an OCR'd version of a 1980 paper
> by SR Mahaney, mutilating the text
> further to remove its attribution
> and create the false impression of
> authorship by the (im)poster.
I'm afraid you misunderstan
Patrick Maupin, 02.04.2010 07:25:
On Apr 1, 11:52 pm, Dennis Lee Bieber wrote:
On Thu, 01 Apr 2010 22:44:51 +0200, superpollo
declaimed the following in gmane.comp.python.general:
how much is one half times one half?
import math
print math.exp((math.log(1) - math.log(2))
On 4/2/2010 6:21 AM, Shashwat Anand wrote:
>>> s = 'si_pos_99_rep_1_0.ita'
>>> res = tuple(re.split(r'(\d+)', s))
>>> res
('si_pos_', '99', '_rep_', '1', '_', '0', '.ita')
This solves the core of the problem, but is not quite there ;-).
Thomas requested conversion of int literals to ints, wh
On Apr 2, 7:52 am, Tim Chase wrote:
> Steve Howell wrote:
> > I forgot this one:
>
> > def obfuscated_triager(rolls, pins,
> > lookup = ['normal'] * 10 + ['strike'] + [None] * 9 + ['spare']
> > ):
> > return lookup[rolls * pins]
>
> Bah...no need to be _quite_ so obscure:
>
Steve Howell wrote:
I forgot this one:
def obfuscated_triager(rolls, pins,
lookup = ['normal'] * 10 + ['strike'] + [None] * 9 + ['spare']
):
return lookup[rolls * pins]
Bah...no need to be _quite_ so obscure:
def triager(rolls, pins):
return {
(1, 10):'strike',
In article <8d79f0cb-9c5b-4243-8891-a15fb311f...@z18g2000prh.googlegroups.com>,
Josh English wrote:
>
>
>Analog Science Fiction and Fact
>Analog
>Science Fiction
>First Contact
>Hard Science Fiction
>
>Stanley Schmidt, Editor
>267 Broadway, 4th Floor
>
On Apr 2, 7:21 am, Steve Holden wrote:
> Steve Howell wrote:
> > On Apr 2, 2:04 am, Steven D'Aprano > cybersource.com.au> wrote:
> [...]
> >> How is the ternary operator "not really ternary, it's binary"? It
> >> requires three arguments, not two, which makes it ternary. In Python
> >> syntax:
>
On Apr 2, 7:05 am, Steve Howell wrote:
> On Apr 2, 2:04 am, Steven D'Aprano
>
>
> cybersource.com.au> wrote:
> > On Thu, 01 Apr 2010 21:16:18 -0700, Steve Howell wrote:
> > > The ironic thing about the ternary operator is that it is not really
> > > ternary; it's binary. Even just making an expr
Steve Howell wrote:
> On Apr 2, 2:04 am, Steven D'Aprano cybersource.com.au> wrote:
[...]
>> How is the ternary operator "not really ternary, it's binary"? It
>> requires three arguments, not two, which makes it ternary. In Python
>> syntax:
>>
>
> Of course, I understand that the ternary operato
On Apr 1, 7:34 pm, Patrick Maupin wrote:
> On Apr 1, 4:42 pm, Tim Chase wrote:
> > Uh, did you try it at the python prompt?
When I try it at the IPython prompt, I get
Object 'how much is one half times one half' not found.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 2, 2:04 am, Steven D'Aprano wrote:
> On Thu, 01 Apr 2010 21:16:18 -0700, Steve Howell wrote:
> > The ironic thing about the ternary operator is that it is not really
> > ternary; it's binary. Even just making an expression from a binary
> > operator inevitably leads to syntax hell.
>
> > T
On Apr 2, 6:24 am, Peter Otten <__pete...@web.de> wrote:
> Thomas Heller wrote:
> > Maybe I'm just lazy, but what is the fastest way to convert a string
> > into a tuple containing character sequences and integer numbers, like
> > this:
>
> > 'si_pos_99_rep_1_0.ita' -> ('si_pos_', 99, '_rep_', 1,
On Apr 1, 11:19 am, KB wrote:
> > Django will probably get you where you want to go the fastest:
>
> > http://www.djangoproject.com/
>
> > In particular, its admin interface will probably automatically generate a
> > usable
> > UI for you without your having to write many templates at all.
>
>
On Apr 2, 8:27 am, A Serious Moment
cross-posted
a 1980 paper by J. Hartmanis and S.R.
Mahaney, falsely taking credit for
their work.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 2, 6:14 am, A Serious Moment
cross-posted
an OCR'd version of a 1980 paper
by SR Mahaney, mutilating the text
further to remove its attribution
and create the false impression of
authorship by the (im)poster.
--
http://mail.python.org/mailman/listinfo/python-list
* Steve Holden:
Alf P. Steinbach wrote:
* Jason Friedman:
Hi, what is the difference between:
def MyClass(object):
pass
and
def MyClass():
pass
If you really meant 'def', then the first is a routine taking one
argument, and the second is a routine of no arguments.
If you meant 'cla
Introducing JSONBOT
JSONBOT is a bot that stores all its data in json format. It runs on
the Google Application Engine and can thus support wave, web and xmpp.
Standalone programms are provided for IRC and console, the goal is to
let both clientside and GAE side communicate through JSON either ove
AN ESSAY ABOUT RESEARCH (fl) ON SPARSE
NP COMPLETE SETS
By
M. Musatov
The purpose of this paper is to review the origins and motivation for
the conjecture sparse NP complete sets do not exist (unless ? NP) and
to describe the development of the ideas and techniques leading to the
recent solution of
Alf P. Steinbach wrote:
> * Jason Friedman:
>> Hi, what is the difference between:
>>
>> def MyClass(object):
>> pass
>>
>> and
>>
>> def MyClass():
>> pass
>
> If you really meant 'def', then the first is a routine taking one
> argument, and the second is a routine of no arguments.
>
> I
On Thu, 01 Apr 2010 11:57:11 +, Harishankar wrote:
> On Wed, 31 Mar 2010 09:40:30 -0700, Javier Montoya wrote:
>
>> Dear all,
>>
>> I'm a newbie in python and would be acknowledge if somebody could shed
>> some light on associative arrays.
>> More precisely, I would like to create a multi-di
Jason Friedman wrote:
> Hi, what is the difference between:
>
> def MyClass(object):
> pass
>
> and
>
> def MyClass():
> pass
In Python 3, nothing. In Python 2, the former gets you a subclass of
object whereas the latter gets you an instance of , for
compatibility with pre-2.2 versions.
* Jason Friedman:
Hi, what is the difference between:
def MyClass(object):
pass
and
def MyClass():
pass
If you really meant 'def', then the first is a routine taking one argument, and
the second is a routine of no arguments.
If you meant 'class' instead of 'def', then it depends o
Thank you for your reply. Unfortunately pynotify is not available as a .py
file but as an .so (shared library) file. In both python 2.5 and 2.6
installations it can be found at
/var/lib/python-support/python2.x/gtk-2.0/pynotify/__init__.py ,
_pynotify.so.
I think it was written in native
1 - 100 of 124 matches
Mail list logo