On Apr 1, 12:48 am, Abethebabe wrote:
> I wanted to know if there was a way I could get a Python program to
> run off of my flash drive as soon as the computer (Windows) detected
> the device?
>
> For example I could have a a simple program that would create a text
> document on the computers desk
Hello!
I need to format a decimal (floating point) number in the following
way:
10 results in '10'
10.5 results in '10.5'
10.50 results in '10.5'
10.5678 results in 10.57
How can I achieve this using standard Python string formatting
operations?
Something like '%.2f' works almost as expected:
>>>
On Thu, Apr 1, 2010 at 2:08 AM, Lacrima wrote:
> Hello!
>
> I need to format a decimal (floating point) number in the following
> way:
> 10 results in '10'
> 10.5 results in '10.5'
> 10.50 results in '10.5'
> 10.5678 results in 10.57
>
> How can I achieve this using standard Python string formatti
Hi Maxim,
If it's the trailing zeroes you're concerned about, here's a work-around:
>>> ('%.2f' % 10.5678).rstrip('0')
'10.57
I'm sure there are better solutions. But this one works for your need,
right?
Cheers,'
Ching-Yun Xavier Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335
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 expression and I
want to generate all possible words that it can match (to compare
performance of regex against an acora based matcher).
T
Hello, Chris!
Thanks for your really quick reply! It works!
On 1 April 2010 12:14, Chris Rebert wrote:
> On Thu, Apr 1, 2010 at 2:08 AM, Lacrima wrote:
> > Hello!
> >
> > I need to format a decimal (floating point) number in the following
> > way:
> > 10 results in '10'
> > 10.5 results in '1
On Apr 1, 6:53 am, rantingrick wrote:
> > 3 fields: quantity - description of the piece bought - price
>
> So what is your plan...?
> * Pop up a dialog with three entrys,
> * have him fill out the three entrys,
> * then have python insert the data into the spreadsheet?
> ...Why bother messi
The idioms
def f(*args, **kwargs):
# Do something.
and
args = (1, 2, 3)
kwargs = dict(a=4, b=5)
g(*args, **kwargs)
are often useful in Python.
I'm finding myself picking up /all/ the arguments and storing them for
later use (as part of a testing framework). So for me it
My town office uses Microsoft operating system. They have a proprietary
accounting system that uses excel for their accounting reports.
I would like to read these report and reproduce the report so that
the report can be seen on the web. I was thinking about using xlrd and
xlwt along with some sort
hi experts,
i m new to python, i m writing crawlers to extract data from some
chinese websites, and i run into a encoding problem.
i have a unicode object, which looks like this u'\xd6\xd0\xce\xc4'
which is encoded in "gb2312", but i have no idea of how to convert it
back to utf-8
to re-create t
On Mar 31, 7:36 pm, Gary Herron wrote:
> JavierMontoyawrote:
> > 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-dimensional associative
> > array. I have for example a l
On Thu, Apr 1, 2010 at 3:58 AM, Javier Montoya wrote:
> On Mar 31, 7:36 pm, Gary Herron wrote:
>> JavierMontoyawrote:
>> > 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
2010/4/1 Mister Yu :
> hi experts,
>
> i m new to python, i m writing crawlers to extract data from some
> chinese websites, and i run into a encoding problem.
>
> i have a unicode object, which looks like this u'\xd6\xd0\xce\xc4'
> which is encoded in "gb2312",
No! Instances of type 'unicode' (i.
Javier Montoya wrote:
> Is it possible to sort the dictionary by the student's grades in
> descending order?
You cannot sort dictionaries, but you can put dictionary items into a list
and then sort that.
Assumming that you have a dictionary student_dict that maps student IDs to
Student instanc
On Apr 1, 7:22 pm, Chris Rebert wrote:
> 2010/4/1 Mister Yu :
>
> > hi experts,
>
> > i m new to python, i m writing crawlers to extract data from some
> > chinese websites, and i run into a encoding problem.
>
> > i have a unicode object, which looks like this u'\xd6\xd0\xce\xc4'
> > which is enc
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-dimensional associative
> array. I have for example a list of stude
On Thu, Apr 1, 2010 at 4:38 AM, Mister Yu wrote:
> On Apr 1, 7:22 pm, Chris Rebert wrote:
>> 2010/4/1 Mister Yu :
>> > hi experts,
>>
>> > i m new to python, i m writing crawlers to extract data from some
>> > chinese websites, and i run into a encoding problem.
>>
>> > i have a unicode object, w
Mister Yu, 01.04.2010 13:38:
i m still not very sure how to convert a unicode object **
u'\xd6\xd0\xce\xc4 ** back to "中文" the string it supposed to be?
You are confused. '\xd6\xd0\xce\xc4' is an encoded byte string, not a
unicode string. The fact that you have it stored in a unicode string
On Apr 1, 8:13 pm, Chris Rebert wrote:
> On Thu, Apr 1, 2010 at 4:38 AM, Mister Yu wrote:
> > On Apr 1, 7:22 pm, Chris Rebert wrote:
> >> 2010/4/1 Mister Yu :
> >> > hi experts,
>
> >> > i m new to python, i m writing crawlers to extract data from some
> >> > chinese websites, and i run into a e
Steven D'Aprano wrote:
On Thu, 01 Apr 2010 00:27:51 +0100, MRAB wrote:
A decorator shouldn't call the function it's decorating.
*raises eyebrow*
Surely, in the general case, a decorator SHOULD call the function it is
decorating? I'm sure you know that, but your wording is funny and could
conf
Wayne wrote:
My town office uses Microsoft operating system. They have a proprietary
accounting system that uses excel for their accounting reports.
I would like to read these report and reproduce the report so that
the report can be seen on the web. I was thinking about using xlrd and
xlwt along
MRAB wrote:
> Steven D'Aprano wrote:
>> On Thu, 01 Apr 2010 00:27:51 +0100, MRAB wrote:
>>
> A decorator shouldn't call the function it's decorating.
*raises eyebrow*
Surely, in the general case, a decorator SHOULD call the function it is
decorating? I'm sure you know that,
Mister Yu, 01.04.2010 14:26:
On Apr 1, 8:13 pm, Chris Rebert wrote:
gb2312_bytes = ''.join([chr(ord(c)) for c in u'\xd6\xd0\xce\xc4'])
unicode_string = gb2312_bytes.decode('gb2312')
utf8_bytes = unicode_string.encode('utf-8') #as you wanted
Simplifying this hack a bit:
gb2312_bytes = u'\x
Greetings!
Perhaps I woke up too early this morning, but this behaviour has me baffled:
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--> test = object()
--> setattr(test, 'example'
On Apr 1, 1:54 am, Steven D'Aprano
wrote:
> At the risk of offending you further, I will suggest that I'm not the
> only one who needs to apply some introspection here. If your skin is so
> thin that you react so explosively to such a minor slight, how are you
> going to react to some of the more
On Apr 1, 6:16 am, Steve Holden wrote:
> MRAB wrote:
>
> > I had the following idea: define the terms 'decorator', 'decoration' and
> > 'decoratee'. The decorator applies the decoration to the decoratee. The
> > decoratee is the function defined locally in the decorator.
>
> It would make more sen
On Apr 1, 6:46 am, Ethan Furman wrote:
> Greetings!
>
> Perhaps I woke up too early this morning, but this behaviour has me baffled:
>
> Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
Ethan Furman wrote:
> Greetings!
>
> Perhaps I woke up too early this morning, but this behaviour has me
> baffled:
>
> Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>
> --> test =
On Apr 1, 12:50 am, Steve Holden wrote:
> > I can well imagine that everybody who has to work with you thoroughly
> > enjoys proving you wrong as often as possible.
>
> I am glad I wasn't drinking when I read this. Liquid in one's nose is so
> uncomfortable.
Well, in that case, I'm glad you enjo
Ethan Furman wrote:
> Greetings!
>
> Perhaps I woke up too early this morning, but this behaviour has me
> baffled:
>
> Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>
> --> test =
Cheetah would work, but it would be a major pain to debug (I hate those 500
Server Error pages) something django (as mentioned above) or turbogears
(with Kid) would get you rolling quickly.
On Wed, Mar 31, 2010 at 8:38 PM, KB wrote:
> Hi there,
>
> Years ago I wrote a LAMP app using python. I fi
On Apr 1, 9:31 pm, Stefan Behnel wrote:
> Mister Yu, 01.04.2010 14:26:
>
> > On Apr 1, 8:13 pm, Chris Rebert wrote:
> >> gb2312_bytes = ''.join([chr(ord(c)) for c in u'\xd6\xd0\xce\xc4'])
> >> unicode_string = gb2312_bytes.decode('gb2312')
> >> utf8_bytes = unicode_string.encode('utf-8') #as you w
On Mar 31, 1:09 pm, Raymond Hettinger wrote:
> On Mar 30, 4:25 pm, s...@sig.for.address (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 th
> 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.
Robert,
Thank you very very much. I had a
On Apr 1, 3:34 am, Wayne wrote:
> My town office uses Microsoft operating system. They have a proprietary
> accounting system that uses excel for their accounting reports.
> I would like to read these report and reproduce the report so that
> the report can be seen on the web. I was thinking about
On Mar 30, 10:56 am, Steve Holden wrote:
> 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:
>
On 1 Apr, 10:57, Jonathan Fine wrote:
> The idioms
> def f(*args, **kwargs):
> # Do something.
> and
> args = (1, 2, 3)
> kwargs = dict(a=4, b=5)
> g(*args, **kwargs)
> are often useful in Python.
>
> I'm finding myself picking up /all/ the arguments and storing them f
On Mar 31, 3:47 pm, "Martin v. Loewis" wrote:
> > WindowsError: [Error 14001] The application has failed to start
> > because its side-by-side configuration is incorrect. Please see the
> > application event log for more detail
>
> This is a configuration error on your system. The application you
On Mar 31, 3:47 pm, "Martin v. Loewis" wrote:
> > WindowsError: [Error 14001] The application has failed to start
> > because its side-by-side configuration is incorrect. Please see the
> > application event log for more detail
>
> This is a configuration error on your system. The application you
Den wrote:
[...]
> I've been following this thread for a few days now. My thoughts are
> that, in view of a long known widely used syntax for this operator,
> python's syntax seems like change for change sake. If current
> programing paradigm provides that particular trinary operator, why
> shoul
Jon Clements wrote:
I'm not sure this'll catch on, it'll be interesting to see other
comments.
However, I believe you can get the behaviour you desire something
like:
import inspect
class AllArgs(object):
def __init__(self, func):
self._func = func
self._spec = inspect.geta
wukong wrote:
> On Mar 31, 3:47 pm, "Martin v. Loewis" wrote:
>>> WindowsError: [Error 14001] The application has failed to start
>>> because its side-by-side configuration is incorrect. Please see the
>>> application event log for more detail
>> This is a configuration error on your system. The a
Steve Holden wrote:
MRAB wrote:
Steven D'Aprano wrote:
On Thu, 01 Apr 2010 00:27:51 +0100, MRAB wrote:
A decorator shouldn't call the function it's decorating.
*raises eyebrow*
Surely, in the general case, a decorator SHOULD call the function it is
decorating? I'm sure you know that, but yo
Hi!
> side-by-side configuration is incorrect
Others have given you an explanation.
A possibility: you use a DLL directly, without having installed.
That is OK with some DLL, and no OK with others DLL.
@-salutations
--
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
"jobs in canada" "jobs in canada for pakistanis" "jobs in canada for
foreigners" "jobs in canada hotels" "jobs in canada for accountants"
"canada jobs" "canada job bank" on http://jobsincanada-net.blogspot.com/
"jobs in canada" "jobs in canada for pakistanis" "jobs in canada for
foreigners" "jobs
In python 3.1,
>>> import exceptions
Traceback (most recent call last):
File "", line 1, in
import exceptions
ImportError: No module named exceptions
in 2.6 no exception is raised
It should be the same in 3.1, isnt it?
Joaquin
--
http://mail.python.org/mailman/listinfo/python-list
There i no module named 'exceptions' in python 2.6 as well as python 3.1
What are you expecting ?
On Thu, Apr 1, 2010 at 10:42 PM, Joaquin Abian wrote:
> In python 3.1,
>
> >>> import exceptions
> Traceback (most recent call last):
> File "", line 1, in
>import exceptions
> ImportError: No
This is what he is expecting. Importing exceptions works fine in 2.6.4, not so
in python 3.1.
Python 2.6.4 (r264:75706, Nov 3 2009, 18:12:54)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import exceptions
>>>
On 4/1/2010 10:16 AM, Steve Howell wrote:
On Apr 1, 6:46 am, Ethan Furman wrote:
On 2.6.2 the error seems to be limited to instances of object. If you
subclass object, you are fine. I do not know why that is so;
As the other Steve said, object is a built-in class; user-defined
subclasses o
Hi,
For purposes I don't want to go into here, I have the following code:
def handleObj(obj):
if isinstance(obj, MyType):
return obj.handle()
elif isinstance(obj, (list, tuple, set)):
return obj.__class__(map (handleObj, obj))
elif isinstance(obj, dict):
return obj.__class__((h
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
import copy
class BaseDummyObject(object):
def __init__(self):
pass
def __getattr__(self, item):
try:
return self.__dict__.__getitem__(item)
excep
Many thanks for the replies, and especially for the very detailed
explanation. Makes much more sense now.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-04-01 13:56 PM, Ani wrote:
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
import copy
class BaseDummyObject(object):
def __init__(self):
pass
def __getattr__(self, item):
try:
return sel
> On Thu, Apr 1, 2010 at 10:42 PM, Joaquin Abian wrote:
>> In python 3.1,
>>
>> >>> import exceptions
>> Traceback (most recent call last):
>> File "", line 1, in
>>import exceptions
>> ImportError: No module named exceptions
>>
>> in 2.6 no exception is raised
>> It should be the same in 3.
On Thu, Apr 1, 2010 at 11:35 AM, hetchkay wrote:
> Hi,
> For purposes I don't want to go into here, I have the following code:
> def handleObj(obj):
> if isinstance(obj, MyType):
> return obj.handle()
> elif isinstance(obj, (list, tuple, set)):
> return obj.__class__(map (handleObj, obj)
Joaquin Abian wrote:
In python 3.1,
import exceptions
Traceback (most recent call last):
File "", line 1, in
import exceptions
ImportError: No module named exceptions
in 2.6 no exception is raised
It should be the same in 3.1, isnt it?
Joaquin
In 2.x, the exceptions m
In article
,
Chris Rebert wrote:
> > On Thu, Apr 1, 2010 at 10:42 PM, Joaquin Abian wrote:
> >> In python 3.1,
> >>
> >> >>> import exceptions
> >> Traceback (most recent call last):
> >> File "", line 1, in
> >>import exceptions
> >> ImportError: No module named exceptions
> >>
> >> in
hetchkay wrote:
> For purposes I don't want to go into here, I have the following code:
> def handleObj(obj):
> if isinstance(obj, MyType):
> return obj.handle()
> elif isinstance(obj, (list, tuple, set)):
> return obj.__class__(map (handleObj, obj))
> elif isinstance(obj, dict):
>
how much is one half times one half?
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 1, 4:38 am, "egl...@gmail.com" wrote:
> Actually, a spreadsheet based solution isn't best fit for such a task.
> I'd recommend to store the data in sqlite3 (also 100% pure python as
> the module is in the stdlib). CSV is good for making invoices or
> something like that.
+1
--
http://mai
> wukong (w) wrote:
>w> also subprocess.py clearly says
>w> """
>w> import sys
>w> mswindows = (sys.platform == "win32")
>w> """
It may sound strange, but even in 64-bit Python on Win64,
sys.plattform=="win32".
You can check that subprocess is working, e.g. with
subprocess.call('dir', she
superpollo wrote:
how much is one half times one half?
Uh, did you try it at the python prompt? If not, here's the answer:
0.1b * 0.1b = 0.01b
Now all you need is to find the recent thread that converts
binary floats to decimal floats ;-)
-tkc
--
http://mail.python.org/mailman/listinf
On Apr 1, 12:10 pm, Robert Kern wrote:
> On 2010-04-01 13:56 PM, Ani wrote:
>
>
>
> > Hi All:
>
> > I am just a beginner in python. Can anyone please tell me what is
> > wrong with this piece of code?
>
> > import copy
> > class BaseDummyObject(object):
>
> > def __init__(self):
> >
On 2010-04-01 16:52 PM, Ani wrote:
On Apr 1, 12:10 pm, Robert Kern wrote:
On 2010-04-01 13:56 PM, Ani wrote:
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
import copy
class BaseDummyObject(object):
def __init__(self):
When coding C I have often found static local variables useful for
doing once-only run-time initializations. For example:
int foo(int x, int y, int z) {
static int first_time = TRUE;
static Mongo *mongo;
if (first_time) {
mongo = heavy_lifting_at_runtime();
first_time = FALSE;
On Thu, Apr 1, 2010 at 3:34 PM, kj wrote:
> When coding C I have often found static local variables useful for
> doing once-only run-time initializations.
> Another approach would be to stuff the static values in the function's
> __dict__. This is less satisfactory than the closure approach
> be
Hi All,
Pydev 1.5.6 has been released
Details on Pydev: http://pydev.org
Details on its development: http://pydev.blogspot.com
Release Highlights:
---
* Django integration:
* New Django project can be created through wizards
* Can set an existing project as
Chris Rebert wrote:
> On Thu, Apr 1, 2010 at 3:34 PM, kj wrote:
>> When coding C I have often found static local variables useful for
>> doing once-only run-time initializations.
>
>> Another approach would be to stuff the static values in the function's
>> __dict__. This is less satisfactory th
On 4/1/2010 6:34 PM, kj wrote:
When coding C I have often found static local variables useful for
doing once-only run-time initializations. For example:
int foo(int x, int y, int z) {
static int first_time = TRUE;
static Mongo *mongo;
if (first_time) {
mongo = heavy_lifting_at_
On Apr 1, 6:10 pm, Steve Holden wrote:
> Chris Rebert wrote:
> > Personally, I hate such abuse with a passion; I think a global
> > variable is clearest.
>
> But the real problem is that the OP is insisting on using purely
> procedural Python when the problem is screaming for an object-oriented
>
On Apr 1, 4:42 pm, Tim Chase wrote:
> superpollo wrote:
> > how much is one half times one half?
>
> Uh, did you try it at the python prompt? If not, here's the answer:
>
> 0.1b * 0.1b = 0.01b
>
> Now all you need is to find the recent thread that converts
> binary floats to decimal floats ;-)
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
without installing python?
Wayne
--
http://mail.python.org/mailman/listinfo/python-list
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
> without installing python?
>
> Wayne
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Short answer: No.
--
Terry Reedy wrote:
> On 4/1/2010 6:34 PM, kj wrote:
>>
>>
>> When coding C I have often found static local variables useful for
>> doing once-only run-time initializations. For example:
>>
>> int foo(int x, int y, int z) {
>>
>>static int first_time = TRUE;
>>static Mongo *mongo;
>>if
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
>> without installing python?
>
> Short answer: No.
Long answe
On Thu, Apr 1, 2010 at 7:34 PM, Patrick Maupin wrote:
> On Apr 1, 4:42 pm, Tim Chase wrote:
>> superpollo wrote:
>> > how much is one half times one half?
>>
>> Uh, did you try it at the python prompt? If not, here's the answer:
>>
>> 0.1b * 0.1b = 0.01b
>>
>> Now all you need is to find the r
I've recently finished reading A Byte Of Python and have the basics of
Python down. I want to continue practice but I'm unsure what I can do.
So I started looking for tutorials to open my mind a little, but
everything I come across are beginner tutorials that cover the same
topics...over and over.
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 one of them to a float so you
get a floating-point result:
>>> 1/2 * 1/2
0
>>> 1/2 * 1/2.0
0.0
Oh...wait ;-)
-tk
Hi, I could use some advice on my project.
It's a browser-based MMOG: "The High Seas" (working title)
Basically it is a trading game set in 1600s or 1700s ... inspirations:
Patrician 3, Mine Things, Space Rangers 2, ...
Travel between cities takes several days: game updates trading ship
position
On Apr 1, 7:25 pm, Abethebabe wrote:
> I've recently finished reading A Byte Of Python and have the basics of
> Python down. I want to continue practice but I'm unsure what I can do.
> So I started looking for tutorials to open my mind a little, but
> everything I come across are beginner tutorial
* kj:
When coding C I have often found static local variables useful for
doing once-only run-time initializations. For example:
int foo(int x, int y, int z) {
static int first_time = TRUE;
static Mongo *mongo;
if (first_time) {
mongo = heavy_lifting_at_runtime();
first_time = FAL
On Apr 1, 7:49 pm, 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 one of them to a float so you
> get a floating-point result:
>
> >
On Thu, 01 Apr 2010 08:27:53 -0700, Den wrote about Python's ternary
operator:
> I've been following this thread for a few days now. My thoughts are
> that, in view of a long known widely used syntax for this operator,
> python's syntax seems like change for change sake. If current
> programing
On Thu, 01 Apr 2010 19:55:27 -0400, David Robinow wrote:
>>> superpollo wrote:
>>> > how much is one half times one half?
[...]
> Well, my python says:
>
> $ 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?)
Python 2.x defaul
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 one of them to a float so you get a
> floating-point
On 04/02/10 13:01, Patrick Maupin wrote:
> On Apr 1, 7:49 pm, 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 one of them to a float
On 01:14 am, srosbo...@gmail.com wrote:
Hi, I could use some advice on my project.
It's a browser-based MMOG: "The High Seas" (working title)
Basically it is a trading game set in 1600s or 1700s ... inspirations:
Patrician 3, Mine Things, Space Rangers 2, ...
Travel between cities takes severa
On Apr 1, 9:50 pm, Lie Ryan wrote:
> On 04/02/10 13:01, Patrick Maupin wrote:
>
>
>
> > On Apr 1, 7:49 pm, 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?)
>
> >> T
On Thu, Apr 1, 2010 at 10: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 nee
Steven D'Aprano wrote:
That's because you need to promote one of them to a float so you get a
floating-point result:
>>> 1/2 * 1/2
0
>>> 1/2 * 1/2.0
0.0
Oh...wait ;-)
Tim, I'm sure you know the answer to this, but for the benefit of the
Original Poster, the problem is that you ne
kj writes:
> When coding C I have often found static local variables useful for
> doing once-only run-time initializations. For example:
>
> int foo(int x, int y, int z) {
> static int first_time = TRUE;
> static Mongo *mongo;
> if (first_time) { ...
Here are some cheesy ways.
1. Put an
On 04/02/10 11:25, Abethebabe wrote:
> I've recently finished reading A Byte Of Python and have the basics of
> Python down. I want to continue practice but I'm unsure what I can do.
> So I started looking for tutorials to open my mind a little, but
> everything I come across are beginner tutorials
On Mar 30, 8:40 am, gentlestone wrote:
> Hi, how can I write the popular C/JAVA syntax in Python?
>
> Java example:
> return (a==b) ? 'Yes' : 'No'
>
> ; first idea is:
> return ('No','Yes')[bool(a==b)]
>
> Is there a more elegant/common python expression for this?
The ironic thing about
In my opinion, the python official documents, include the tutorial, language
reference, library reference, distributing python modules, also extending
and embedding, Python/C API, are all what you need to learn python and use
it, as long as you can read into it. Also you can read other python
progr
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))
> + (math.
On Thu, 01 Apr 2010 22:34:46 -0500, Tim Chase wrote:
>> Tim, I'm sure you know the answer to this, but for the benefit of the
>> Original Poster, the problem is that you need to promote *both*
>> divisions to floating point. Otherwise one of them will give int 0,
>> which gives 0.0 when multiplied
Wayne wrote:
>
>My town office uses Microsoft operating system. They have a proprietary
>accounting system that uses excel for their accounting reports.
>I would like to read these report and reproduce the report so that
>the report can be seen on the web.
If it were me, I'd just have Excel print
97 matches
Mail list logo