Hi all
I needed something similar to, but not quite the same as,
collections.namedtuple.
The differences are that namedtuple requires the 'names' to be provided at
creation time, and then lends itself to creating multiple instances of
itself. I wanted a more generic class where I could suppl
En Tue, 30 Mar 2010 18:01:40 -0300, News123 escribió:
Gabriel Genellina wrote:
En Thu, 25 Mar 2010 05:31:05 -0300, News123 escribió:
I'm havign a small xmlrpc client, which works normally fine.
(xmlrpc via https)
Sometimes however I receive an Exception about an expat error.
The output, t
On 2010-03-30 18:25 , Victor Eijkhout wrote:
I have two arrays, made with numpy. The first one has values that I want
to use as sorting keys; the second one needs to be sorted by those keys.
Obviously I could turn them into a dictionary of pairs and sort by the
first member, but I think that's n
John Bokma wrote:
And maybe you're right, the Python one could've been written:
if list is None:
list = []
which looks, now, also more readable to me as well.
Though there's a slight difference[1], I'd usually use
lst = lst or []
for your particular initialization use case.
-tkc
[1]
On Mar 30, 10:08 am, 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=
On Tue, Mar 30, 2010 at 9:59 PM, Chris Colbert wrote:
>
>
> On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout wrote:
>
>> I have two arrays, made with numpy. The first one has values that I want
>> to use as sorting keys; the second one needs to be sorted by those keys.
>> Obviously I could turn t
On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout wrote:
> I have two arrays, made with numpy. The first one has values that I want
> to use as sorting keys; the second one needs to be sorted by those keys.
> Obviously I could turn them into a dictionary of pairs and sort by the
> first member, bu
Robert Fendt writes:
> And thus spake John Bokma
> Tue, 30 Mar 2010 13:19:19 -0600:
>
>> And
>>
>> a == b and 'Yes' or 'No'
>>
>> isn't a Perl-ism?
>
> I never said that this would be better.
It was not my intention to imply you did. But yet I do see books on
Python mention the and or usage
On 30Mar2010 10:25, Chris Colbert wrote:
| not really, the int will eventually overflow and cycle around ;)
|
| On Tue, Mar 30, 2010 at 8:11 AM, Xavier Ho wrote:
|
| > Did no one notice that
| > for(i = 99; i > 0; ++i)
| > Gives you an infinite loop (sort of) because i starts a 99, and increase
> On Mar 30, 2010 7:39pm, Chris Rebert wrote:
>> On Tue, Mar 30, 2010 at 4:33 PM, hid...@gmail.com> wrote:
>> > Hello list, i want to know how could i fetch a file from an email, what
>> > kind
>> > of library i have to use for that, actually i am working in the support
>> > of
>> > IMAP and POP3
I did that but i want to know if i have a file inside the mail how could i
download that file from my mail.
On Mar 30, 2010 7:39pm, Chris Rebert wrote:
On Tue, Mar 30, 2010 at 4:33 PM, hid...@gmail.com> wrote:
> Hello list, i want to know how could i fetch a file from an email, what
kind
Victor Eijkhout wrote:
I have two arrays, made with numpy. The first one has values that I want
to use as sorting keys; the second one needs to be sorted by those keys.
Obviously I could turn them into a dictionary of pairs and sort by the
first member, but I think that's not very efficient, at
Jonathan Hayward wrote:
> I've posted "Usability, the Soul of Python: An Introduction to the
> Python Programming Language Through the Eyes of Usability", at:
>
>http://JonathansCorner.com/python/
>
> The basic suggestion is that much of what works well in Python has
> something to do with th
On Tue, 30 Mar 2010 15:46:12 -0700 (PDT)
ASh wrote:
> > > new_start_date = "NOW() - '29 days'::INTERVAL"
> > > self.dyndb.orderdb.query('''update set creation_date
> > > = %s
> > > where id_order = %s''', (new_start_date, "123"))
> >
> > Put single quotes a
Victor Eijkhout wrote:
> I have two arrays, made with numpy. The first one has values that I want
> to use as sorting keys; the second one needs to be sorted by those keys.
> Obviously I could turn them into a dictionary of pairs and sort by the
> first member, but I think that's not very efficien
Justin Park wrote:
> Sorry, my mistake.
>
> The real problem is this.
> When I started working on the package, somehow all of indentations were
> made by space-bars instead of using tabs.
> But when I am implementing my own on top of it, I still use tabs to make
> indentations.
>
> This is causin
D'Arcy J.M. Cain wrote:
> On Tue, 30 Mar 2010 13:47:42 -0700 (PDT)
> ASh wrote:
>> Hi, please help me understand why am I getting error with this query
>>
>>
>> new_start_date = "NOW() - '29 days'::INTERVAL"
>> self.dyndb.orderdb.query('''update set creation_date
>> =
* Victor Eijkhout:
I have two arrays, made with numpy. The first one has values that I want
to use as sorting keys; the second one needs to be sorted by those keys.
Obviously I could turn them into a dictionary of pairs and sort by the
first member, but I think that's not very efficient, at leas
Lawrence D'Oliveiro wrote:
> In message <7316f3d2-bcc9-4a1a-8598-
> cdd5d41fd...@k17g2000yqb.googlegroups.com>, Joaquin Abian wrote:
>
>> (a==b) and 'YES' or 'NO'
>>
>> Yes, ugly
>
> Why would you say that’s ugly?
>
> By the way, you don’t need the parentheses.
But at the same time, if you don'
On Tue, Mar 30, 2010 at 4:33 PM, wrote:
> Hello list, i want to know how could i fetch a file from an email, what kind
> of library i have to use for that, actually i am working in the support of
> IMAP and POP3.
Next time, consult the Global Module Index
(http://docs.python.org/modindex.html) b
In message , Alf P. Steinbach
wrote:
> This is just unsubstantiated opinion, but worse, it makes a tacit
> assumption that there is "best" way to do indentation. However, most
> programmers fall into that trap, and I've done it myself.
Having used so many different languages over the years, I ha
Hello list, i want to know how could i fetch a file from an email, what
kind of library i have to use for that, actually i am working in the
support of IMAP and POP3.
Thanks.
Diego I. Hidalgo D.
--
http://mail.python.org/mailman/listinfo/python-list
I have two arrays, made with numpy. The first one has values that I want
to use as sorting keys; the second one needs to be sorted by those keys.
Obviously I could turn them into a dictionary of pairs and sort by the
first member, but I think that's not very efficient, at least in space,
and this
In message <20100331003241.47fa9...@vulcan.local>, Robert Fendt wrote:
> The braces are gone, and with them the holy wars.
Let me start a new one. I would still put in some kind of explicit indicator
of the end of the grouping construct:
count = 99
while count > 0:
print u'%d sl
On Tue, Mar 30, 2010 at 3:32 PM, Robert Fendt wrote:
> And thus spake "Alf P. Steinbach"
> Tue, 30 Mar 2010 13:40:22 +0200:
>>
>> From a usability standpoint, the braces go with the lines to print out the
>> stanza rather than the for statement or the code after, so the following is
>> best:
>
In message <7316f3d2-bcc9-4a1a-8598-
cdd5d41fd...@k17g2000yqb.googlegroups.com>, Joaquin Abian wrote:
> (a==b) and 'YES' or 'NO'
>
> Yes, ugly
Why would you say that’s ugly?
By the way, you don’t need the parentheses.
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, my mistake.
The real problem is this.
When I started working on the package, somehow all of indentations were
made by space-bars instead of using tabs.
But when I am implementing my own on top of it, I still use tabs to make
indentations.
This is causing a problem.
I have to either conform
Sometimes when I am working on an already generated package,
the python shell cannot perceive the presence of an attribute that I
implemented on top of what was there.
Is there a way to have it perceive newly created attributes?
Thanks,
Justin.
--
http://mail.python.org/mailman/listinfo/python-l
On Mar 31, 12:50 am, "D'Arcy J.M. Cain" wrote:
> On Tue, 30 Mar 2010 13:47:42 -0700 (PDT)
>
> ASh wrote:
> > Hi, please help me understand why am I getting error with this query
>
> > new_start_date = "NOW() - '29 days'::INTERVAL"
> > self.dyndb.orderdb.query('''update xxx
On Mar 31, 12:26 am, Philip Semanchuk wrote:
> On Mar 30, 2010, at 4:47 PM, ASh wrote:
>
> > Hi, please help me understand why am I getting error with this query
>
> > new_start_date = "NOW() - '29 days'::INTERVAL"
> > self.dyndb.orderdb.query('''update set creation_date
And thus spake "Alf P. Steinbach"
Tue, 30 Mar 2010 13:40:22 +0200:
>
> From a usability standpoint, the braces go with the lines to print out the
> stanza rather than the for statement or the code after, so the following is
> best:
>
> for(i = 99; i > 0; ++i)
> {
> printf("%d slabs
On 2010-03-30, Grant Edwards wrote:
> I just installed odtwriter 1.3d on a Gentoo system running Python
> 2.6.4. I used the normal "python setup.py build" then "python
> setup.py install" method. But, odtwriter doesn't seem to work:
>
> rst2odt.py --help
>
> Traceback (most recent call l
On 2010-03-30 13:16:00 -0700, Robert Fendt said:
I find such a convoluted construct especially ugly in a language
which I previously regarded as having a rather striking beauty
of syntactical simplicity. The construct is superfluous,
illogical, unelegant, and thus very un-pythonesque, IMHO. But
On Tue, Mar 30, 2010 at 2:31 PM, Justin Park wrote:
> Suppose I have a list.
> a = list()
> And suppose allowed digits as the element are 1,2,3,4,5.
>
> What can I do in order to iterate over all possible values for each element?
> For instance, the sequence of the list I want to have would be
> [
Thanks!
It works!
Justin.
Chris Rebert wrote:
> On Tue, Mar 30, 2010 at 2:31 PM, Justin Park wrote:
>
>> Suppose I have a list.
>> a = list()
>> And suppose allowed digits as the element are 1,2,3,4,5.
>>
>> What can I do in order to iterate over all possible values for each element?
>> For i
I just installed odtwriter 1.3d on a Gentoo system running Python
2.6.4. I used the normal "python setup.py build" then "python
setup.py install" method. But, odtwriter doesn't seem to work:
rst2odt.py --help
Traceback (most recent call last):
File "/usr/bin/rst2odt.py", line 5, in
Justin Park wrote:
Suppose I have a list.
a = list()
And suppose allowed digits as the element are 1,2,3,4,5.
What can I do in order to iterate over all possible values for each element?
For instance, the sequence of the list I want to have would be
[1,1,1,1,1]
[1,1,1,1,2]
[1,1,1,1,3]
[5,
On 2010-03-30 16:31 PM, Justin Park wrote:
Suppose I have a list.
a = list()
And suppose allowed digits as the element are 1,2,3,4,5.
What can I do in order to iterate over all possible values for each element?
For instance, the sequence of the list I want to have would be
[1,1,1,1,1]
[1,1,1,1,2
On Tue, 30 Mar 2010 13:47:42 -0700 (PDT)
ASh wrote:
> Hi, please help me understand why am I getting error with this query
>
>
> new_start_date = "NOW() - '29 days'::INTERVAL"
> self.dyndb.orderdb.query('''update set creation_date
> = %s
> where id_order
And thus spake MRAB
Tue, 30 Mar 2010 22:43:04 +0100:
> I think you mean that it's very _un-Pythonic_ (perhaps because it's very
> very Pythonesque)! :-)
Yes. Of course. What was I thinking. ;-)
Regards,
Robert
--
http://mail.python.org/mailman/listinfo/python-list
Hi Peter and Jean-Michel,
thanks for all your hints and pieces of code.
It took me a while to play around with what I got from you (and some
study of Vinay's module documentation.
Now I have come up with a more complete solution I'm quite satisfied
with. And I would be very glad to receive yo
Robert Fendt wrote:
And thus spake John Bokma
Tue, 30 Mar 2010 13:19:19 -0600:
And
a == b and 'Yes' or 'No'
isn't a Perl-ism?
I never said that this would be better. I don't even get the
point of what the advantage is supposed to be of inverting the
order of the return statement and the
LX wrote:
On Mar 29, 6:34 pm, MRAB wrote:
LX wrote:
Hi all, I have a question about decorators. I would like to use them
for argument checking, and pre/post conditions. However, I don't want
the additional overhead when I run in non-debug mode. I could do
something like this, using a simple tr
Suppose I have a list.
a = list()
And suppose allowed digits as the element are 1,2,3,4,5.
What can I do in order to iterate over all possible values for each element?
For instance, the sequence of the list I want to have would be
[1,1,1,1,1]
[1,1,1,1,2]
[1,1,1,1,3]
[5,5,5,5,4]
[5,5,5,5,5]
On Mar 30, 2010, at 4:47 PM, ASh wrote:
Hi, please help me understand why am I getting error with this query
new_start_date = "NOW() - '29 days'::INTERVAL"
self.dyndb.orderdb.query('''update set creation_date
= %s
where id_order = %s''', (new_start_date,
On Mar 30, 1:52 pm, MRAB wrote:
> John Nagle wrote:
> > aditya wrote:
> >> On Mar 30, 10:49 am, Raymond Hettinger wrote:
> >>> On Mar 30, 8:13 am, aditya wrote:
>
> To get the decimal representation of a binary number, I can just do
> this:
> int('11',2) # returns 3
> But dec
Hi Gabriel,
Gabriel Genellina wrote:
> En Thu, 25 Mar 2010 05:31:05 -0300, News123 escribió:
>
>> I'm havign a small xmlrpc client, which works normally fine.
>> (xmlrpc via https)
>>
>> Sometimes however I receive an Exception about an expat error.
>>
>>
>> The output, that I receive is:
>> F
Hi, please help me understand why am I getting error with this query
new_start_date = "NOW() - '29 days'::INTERVAL"
self.dyndb.orderdb.query('''update set creation_date
= %s
where id_order = %s''', (new_start_date, "123"))
...
psycopg2.DataError: invali
On Mar 29, 7:11 pm, Steven D'Aprano
wrote:
> On Mon, 29 Mar 2010 17:54:26 -0700, LX wrote:
> > Hi all, I have a question about decorators. I would like to use them for
> > argument checking, and pre/post conditions. However, I don't want the
> > additional overhead when I run in non-debug mode. I
On Mar 29, 6:34 pm, MRAB wrote:
> LX wrote:
> > Hi all, I have a question about decorators. I would like to use them
> > for argument checking, and pre/post conditions. However, I don't want
> > the additional overhead when I run in non-debug mode. I could do
> > something like this, using a simpl
"jobs in kuwait" "jobs in kuwait for pakistanis" "jobs in kuwait
2010" "jobs in kuwait airways" "jobs in kuwait banks" "jobs in kuwait
telecom" "kuwait jobs" "kuwait airways" "kuwait jobs online" on
http://jobsinkuwait-net.blogspot.com/"jobs in kuwait" "jobs in
kuwait for pakistanis" "jobs
Robert Fendt wrote:
> And thus spake John Bokma
> Tue, 30 Mar 2010 13:19:19 -0600:
>
>> And
>>
>> a == b and 'Yes' or 'No'
>>
>> isn't a Perl-ism?
>
> I never said that this would be better. I don't even get the
> point of what the advantage is supposed to be of inverting the
> order of the re
And thus spake John Bokma
Tue, 30 Mar 2010 13:19:19 -0600:
> And
>
> a == b and 'Yes' or 'No'
>
> isn't a Perl-ism?
I never said that this would be better. I don't even get the
point of what the advantage is supposed to be of inverting the
order of the return statement and the conditional ch
Chris
On Tue, Mar 30, 2010 at 11:14 AM, John Nagle wrote:
> aditya wrote:
>
>> On Mar 30, 10:49 am, Raymond Hettinger wrote:
>>
>>> On Mar 30, 8:13 am, aditya wrote:
>>>
>>> To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But d
According to Wikipedia, this is called the Whitesmith style:
for(i = 99; i > 0; ++i)
{
printf("%d slabs of spam in my mail!\n", i);
printf("%d slabs of spam,\n", i);
printf("Send one to abuse and Just Hit Delete,\n");
printf("%d slabs of spam in my mail!\n\n", i + 1);
On 30 mar, 21:19, John Bokma wrote:
> Robert Fendt writes:
> > In fact, the syntax just shouts 'do [...] unless' to me. And
> > that's so strong a Perl-ism I cannot quite express how ugly I
> > actually find it...
>
> And
>
> a == b and 'Yes' or 'No'
>
> isn't a Perl-ism?
>
> Sheesh, this group
Robert Fendt writes:
> In fact, the syntax just shouts 'do [...] unless' to me. And
> that's so strong a Perl-ism I cannot quite express how ugly I
> actually find it...
And
a == b and 'Yes' or 'No'
isn't a Perl-ism?
Sheesh, this group would be so much nicer without the constant dragging
in
John Nagle wrote:
aditya wrote:
On Mar 30, 10:49 am, Raymond Hettinger wrote:
On Mar 30, 8:13 am, aditya wrote:
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5,
And thus spake Steve Holden
Tue, 30 Mar 2010 13:56:04 -0400:
> >> Yes, Python has ternary operator-like syntax:
> >> return ('Yes' if a==b else 'No')
> >>
> >> Note that this requires a recent version of Python.
> >
> > Who let the dogs in? That's awful syntax.
>
> Yes, that's deliberately
On 2010-03-30, John Nagle wrote:
> Hex floats are useful because you can get a string representation of
> the exact value of a binary floating point number. It should always
> be the case that
>
>float.fromhex(float.hex(x)) == x
Until you try running your program on a machine that repre
On 2010-03-30 12:11 PM, Steven D'Aprano wrote:
On Tue, 30 Mar 2010 10:08:31 -0700, John Nagle wrote:
Yes, Python has ternary operator-like syntax: return ('Yes' if a==b
else 'No')
Note that this requires a recent version of Python.
Who let the dogs in? That's awful syntax.
I used to
Joaquin Abian wrote:
Hi,
PyPI is reaching the 1 package figure (In the case of 3.x only
about 140 packages and increasing very very slowly).
Looking at available packages for 3.x I observed that some packages
are listed several times. For example, lxml is listed 5 times.
Are these repetition
On Mar 30, 10:49 am, Raymond Hettinger wrote:
> On Mar 30, 8:13 am, aditya wrote:
>
> > To get the decimal representation of a binary number, I can just do
> > this:
>
> > int('11',2) # returns 3
>
> > But decimal binary numbers throw a ValueError:
>
> > int('1.1',2) # should return 1.5, throws e
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 there
aditya wrote:
On Mar 30, 10:49 am, Raymond Hettinger wrote:
On Mar 30, 8:13 am, aditya wrote:
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5, throws error instea
Hi,
PyPI is reaching the 1 package figure (In the case of 3.x only
about 140 packages and increasing very very slowly).
Looking at available packages for 3.x I observed that some packages
are listed several times. For example, lxml is listed 5 times.
Are these repetitions included in the packa
This question comes up at least once a month, eliciting a thread that
goes on for day.
Wouldn't it be wise to put a link on the bottom of the mail list?
Something like
CPAN for Python == PyPi << make that an href
or
Python( CPAN ) = PyPi
Not too many characters.
sph
On 03/30/2010 09:23 AM
On Tue, 30 Mar 2010 10:08:31 -0700, John Nagle wrote:
>> Yes, Python has ternary operator-like syntax: return ('Yes' if a==b
>> else 'No')
>>
>> Note that this requires a recent version of Python.
>
> Who let the dogs in? That's awful syntax.
I used to think so to, but now I like it. It m
On Tue, Mar 30, 2010 at 1:08 PM, 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 ('N
On Tue, 30 Mar 2010 08:40:56 -0700, 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)]
You don't need the call to bool.
('No','Yes')[a==b]
> Is there a
On Tue, 30 Mar 2010 08:28:50 -0700, Patrick Maupin wrote:
> On Mar 30, 10:13 am, aditya wrote:
>> To get the decimal representation of a binary number, I can just do
>> this:
>>
>> int('11',2) # returns 3
>>
>> But decimal binary numbers throw a ValueError:
>>
>> int('1.1',2) # should return 1.5,
On Mar 30, 2010, at 12:23 PM, Someone Something wrote:
Hi,
I've learned python a few months ago but I still use Perl because of
CPAN and the tremendous amount of stuff that's already been done for
you. is there something like CPAN for python?
Yes and no, depending on what CPAN means to yo
This has been discussed tons of times. You should have atleast googled it.
Python have nothing like CPAN and Cheese Shop (pypi) comes closest to it.
On Tue, Mar 30, 2010 at 10:21 PM, Kushal Kumaran <
kushal.kumaran+pyt...@gmail.com > wrote:
> On Tue, Mar 30, 2010 at 9:53 PM, Someone Something
>
On Mar 30, 5:40 pm, 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 there a more elegant/common python expression for this?
(a==b) and 'YES' or 'NO
On 2010-03-30 12:08 PM, 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 there a more elegant/com
On Tue, Mar 30, 2010 at 9:53 PM, Someone Something wrote:
> Hi,
> I've learned python a few months ago but I still use Perl because of CPAN
> and the tremendous amount of stuff that's already been done for you. is
> there something like CPAN for python?
>
Try PyPI. http://pypi.python.org/pypi
--
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 there a more elegant/common python expression for this?
Yes
I forgot to mention, I'm using Python 2.5.x. I can't use Python 3
unfortunately, the 3rd party application uses Py2.5.x internally, so I
have to limit the functionality to that version.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I have the following situation: I've got a 3rd party application that
has a Python API. The applicaiton has integrated support for MIDI
Hardware Controllers, which can be used to manipulate various
parameters of the application. The app can also load Python User
Scripts, which can define th
Hi,
I've learned python a few months ago but I still use Perl because of CPAN
and the tremendous amount of stuff that's already been done for you. is
there something like CPAN for python?
--
http://mail.python.org/mailman/listinfo/python-list
>> 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 there a more elegant/common python expression for this?
>
> return ('Yes' if a == b else 'No')
And for less cl
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 there a more elegant/common python expression for this?
Yes, Python
On Mar 30, 10:49 am, Raymond Hettinger wrote:
> On Mar 30, 8:13 am, aditya wrote:
>
> > To get the decimal representation of a binary number, I can just do
> > this:
>
> > int('11',2) # returns 3
>
> > But decimal binary numbers throw a ValueError:
>
> > int('1.1',2) # should return 1.5, throws e
Chris Withers wrote:
> Hi All,
>
> Using easy_install to get PyDispatcher results in:
>
...
> Who's the maintainer of PyDispatcher nowadays? Would be handy if they
> removed the sourceforge link from pypi.
...
Thanks for the report. I've released a 2.0.2 version on PyPI. That
should now work pro
On Mar 30, 10:37 am, Benjamin Kaplan wrote:
> On Tue, Mar 30, 2010 at 11:13 AM, aditya wrote:
> > To get the decimal representation of a binary number, I can just do
> > this:
>
> > int('11',2) # returns 3
>
> > But decimal binary numbers throw a ValueError:
>
> > int('1.1',2) # should return 1.5
aditya wrote:
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5, throws error instead.
Is this by design? It seems to me that this is not the correct
behavior.
int
Doh!
Well the problem is that int's are integers. So yeah, you can't even do
that with normal value "int ('2.1')" will also throw an error. And
floats don't support radix conversion, because no-one really writes
numbers that way. (At least computer programmers...)
On 3/30/2010 11:43 AM, Shash
On Mar 30, 8:13 am, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that this
On Mar 30, 11: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 there a more elegant/common python expression for this?
return ('Yes' if a ==
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 there a more elegant/common python expression for this?
--
http://mail.python.org/mailman/listinfo/python-list
The conversion is not supported for decimal integers AFAIK, however
'0b123.456' is always valid. I guess you can always get a decimal number
convertor onto Python-recipes
On Tue, Mar 30, 2010 at 9:05 PM, Grant Olson wrote:
> On 3/30/2010 11:13 AM, aditya wrote:
> > To get the decimal represent
On Tue, Mar 30, 2010 at 11:13 AM, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems t
On 3/30/2010 11:13 AM, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me tha
On Mar 30, 8:53 am, Mel wrote:
> floats are nasty -- as evidence the recent thread on comparing floats for
> equality. People use floats when they have to. fsum exists because of
> this:
...
I understand there are technical reasons for why math.fsum() exists.
I still think that whatever math.f
On Mar 30, 10:13 am, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that thi
decimal binary number is not included AFAIK
On Tue, Mar 30, 2010 at 8:43 PM, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws err
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5, throws error instead.
Is this by design? It seems to me that this is not the correct
behavior.
- Aditya
--
http://
not really, the int will eventually overflow and cycle around ;)
On Tue, Mar 30, 2010 at 8:11 AM, Xavier Ho wrote:
> Did no one notice that
>
>
> for(i = 99; i > 0; ++i)
>
> Gives you an infinite loop (sort of) because i starts a 99, and increases
> every loop?
>
> Cheers,
>
> Ching-Yun Xavier H
Patrick Maupin wrote:
> Because sum() is the obvious way to sum floats; now the existence of
> math.fsum() means there are TWO obvious ways to sum floats. Is that
> really that hard to understand? How can you misconstrue this so badly
> that you write something that can be (easily) interpreted t
Lie Ryan wrote:
> On 03/29/2010 01:59 AM, Steven D'Aprano wrote:
>> On Sun, 28 Mar 2010 06:48:21 +1100, Lie Ryan wrote:
>>
>>> On 03/22/2010 07:07 PM, Steven D'Aprano wrote:
Perhaps you should have said that it was a wrapper around deque giving
richer functionality, rather than giving the
1 - 100 of 112 matches
Mail list logo