On Mon, Sep 5, 2011 at 10:57 PM, xyz wrote:
> hi all:
>
> As we know , 1.1 * 1.1 is 1.21 .
> But in python ,I got following :
>
1.1 * 1.1
> 1.2102
>
> why python get wrong result?
It's not Python's fault per se, rather it's the inherent nature of
binary floating-point arithmetic
hi all:
As we know , 1.1 * 1.1 is 1.21 .
But in python ,I got following :
>>> 1.1 * 1.1
1.2102
why python get wrong result? Who can tell me where's the 0.0002
from?
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 6 Sep 2011 11:10 am Chris Torek wrote:
>>> black_knight = K()
>>> black_knight.spam()
>>> black_knight.eggs()
>>>
>>> the first parameters ... are magic, and invisible.
>>>
>>> Thus, Python is using the "explicit is better than implicit" rule
>>> in the definition, but not at t
On Aug 31, 9:35 am, "T. Goodchild" wrote:
> I’m new to Python, and I love it. The philosophy of the language (and
> of the community as a whole) is beautiful to me.
Welcome aboard mate!
> But one of the things that bugs me
Oh here we go! :-)
> is the requirement that all class
> methods have
On 9/5/2011 7:18 PM, Steven D'Aprano wrote:
Terry Reedy wrote:
The doc says "-c
Execute the Python code in command. command can be one or more
statements separated by newlines,"
However, I have no idea how to put newlines into a command-line string.
I imagine that it depends on the shell you
>Chris Torek writes:
>[snip]
>> when you have [an] instance and call [an] instance or class method:
[note: I have changed the names very slightly here, and removed
additional arguments, on purpose]
>> black_knight = K()
>> black_knight.spam()
>> black_knight.eggs()
>>
>> the first pa
On 9/5/2011 3:04 PM, Jean-Michel Pichavant wrote:
William Gill wrote:
Not to split hairs, but syntactically f(x) is a function in many
programming paradigms.
As I understand it functional programming places specific requirements
on functions, i.e.referential transparency. So f(x) may or may no
Tim Roberts wrote:
> Martin De Kauwe wrote:
>>
>>If I wanted to print an entire module, skipping the attributes
>>starting with "__" is there an *optimal* way?
>
> Your question is somewhat ambiguous. When I read "print an entire
> module", I assumed you were asking for a way to print the sourc
Jon Redgrave wrote:
> It seems unreasonably hard to write simple one-line unix command line
> filters in python:
>
> eg: ls | python -c " print x.upper()"
Python is neither bash nor Perl. It is not intended to compete in the "quick
and dirty one-liner commands" stakes.
However, you might like
Trying to follow the suggestion this would be the alternate
implementation.
import sys
sys.path.append("/Users/mdekauwe/Desktop/")
import params
#params.py contains
#apples = 12.0
#cats = 14.0
#dogs = 1.3
fname = "test.asc"
try:
ofile = open(fname, 'w')
except IOError:
raise IOError("Can
Terry Reedy wrote:
> The doc says "-c
> Execute the Python code in command. command can be one or more
> statements separated by newlines,"
>
> However, I have no idea how to put newlines into a command-line string.
I imagine that it depends on the shell you are using, but bash on Linux
makes i
On 06/09/11 00:40, alex23 wrote:
On Sep 5, 3:18 pm, Simon Cropper
wrote:
My investigations have generally found that windows/forms/data entry
screen can be created for a specific table or view, but these are
hard-wired during development. Is there anyway of rapidly defining the
grid during runti
Hi,
Tim yes I had a feeling my posting might be read as ambiguous! Sorry I
was trying to quickly think of a good example. Essentially I have a
set of .ini parameter files which I read into my program using
configobj, I then replace the default module parameters if the user
file is different (in my
On 9/5/2011 5:32 PM, Jon Redgrave wrote:
Am I missing something obvious?
ls | python -c "for line in __import__('sys').stdin: print (line.upper())"
Ah, so I am missing something - it is possible - but 'obvious'?
Do people think it should be more accessible
__import__ is well-documented and
On 9/5/2011 1:45 PM, William Gill wrote:
On 9/4/2011 9:13 AM, rusi wrote:
On Sep 3, 9:15 pm, William Gill wrote:
During some recent research, and re-familiarization with Python, I came
across documentation that suggests that programming using functions, and
programming using objects were someho
On 9/5/2011 4:38 PM, Jon Redgrave wrote:
It seems unreasonably hard to write simple one-line unix command line
filters in python:
eg: ls | python -c " print x.upper()"
to get at sys.stdin or similar needs an import, which makes a
subsequent for-loop illegal.
python -c "import sys; for x in sy
Python has been ported to the web browser at pythonfiddle.com. Python
Fiddle can import snippets of code that you are reading on a web page
and run them in the browser. It supports a few popular libraries.
Another common usage is to post code on the site to allow other people
to play around with i
> > Am I missing something obvious?
>
> ls | python -c "for line in __import__('sys').stdin: print (line.upper())"
Ah, so I am missing something - it is possible - but 'obvious'?
Do people think it should be more accessible
--
http://mail.python.org/mailman/listinfo/python-list
On 05/09/11 22:38, Jon Redgrave wrote:
> It seems unreasonably hard to write simple one-line unix command line
> filters in python:
>
> eg: ls | python -c " print x.upper()"
>
> to get at sys.stdin or similar needs an import, which makes a
> subsequent for-loop illegal.
> python -c "import sys;
It seems unreasonably hard to write simple one-line unix command line
filters in python:
eg: ls | python -c " print x.upper()"
to get at sys.stdin or similar needs an import, which makes a
subsequent for-loop illegal.
python -c "import sys; for x in sys.stdin(): print x" <<- SyntaxError
Am I mi
Martin De Kauwe wrote:
>
>If I wanted to print an entire module, skipping the attributes
>starting with "__" is there an *optimal* way?
Your question is somewhat ambiguous. When I read "print an entire module",
I assumed you were asking for a way to print the source code, perhaps with
syntax co
William Gill wrote:
Not to split hairs, but syntactically f(x) is a function in many
programming paradigms.
As I understand it functional programming places specific requirements
on functions, i.e.referential transparency. So f(x) may or may not be
"functional".
x.f() is also a function,
On 9/3/2011 12:25 PM, Steven D'Aprano wrote:
William Gill wrote:
Are they suggesting that any function that takes an object as an
argument should always be a method of that object?
Yes.
I can think of times when a special application, such as a converter,
would take an object as an argumen
On 9/4/2011 9:13 AM, rusi wrote:
On Sep 3, 9:15 pm, William Gill wrote:
During some recent research, and re-familiarization with Python, I came
across documentation that suggests that programming using functions, and
programming using objects were somehow opposing techniques.
Staying with (fo
On 9/5/2011 9:15 AM, Kristofer Tengström wrote:
Thanks everyone, moving the declaration to the class's __init__ method
did the trick. Now there's just one little problem left. I'm trying to
create a list that holds the parents for each instance in the
hierarchy. This is what my code looks like no
On Sep 5, 10:06 am, Martin De Kauwe wrote:
> Hi,
>
> If I wanted to print an entire module, skipping the attributes
> starting with "__" is there an *optimal* way? Currently I am doing
> something like this. Note I am just using sys here to make the point
>
> import sys
>
> data = []
> for attr in
On 05-Sep-11 12:22 PM, Dan Nagle wrote:
Hello,
On 2011-09-05 16:15:20 +, W. eWatson said:
On 9/5/2011 8:24 AM, Chris Angelico wrote:
On Tue, Sep 6, 2011 at 1:15 AM, W. eWatson
wrote:
See Subject.
To what extent "familiar"? I have it installed on several computers,
but only because
Hello,
On 2011-09-05 16:15:20 +, W. eWatson said:
On 9/5/2011 8:24 AM, Chris Angelico wrote:
On Tue, Sep 6, 2011 at 1:15 AM, W. eWatson wrote:
See Subject.
To what extent "familiar"? I have it installed on several computers,
but only because it comes with Open Wat C/C++.
With some
On 9/5/2011 8:24 AM, Chris Angelico wrote:
On Tue, Sep 6, 2011 at 1:15 AM, W. eWatson wrote:
See Subject.
--
http://mail.python.org/mailman/listinfo/python-list
To what extent "familiar"? I have it installed on several computers,
but only because it comes with Open Wat C/C++.
With something
Jon Clements wrote:
> I
> must say I'm not 100% sure what the OP wants to achieve...
Learn Python?
;)
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 6, 2011 at 1:15 AM, W. eWatson wrote:
> See Subject.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
To what extent "familiar"? I have it installed on several computers,
but only because it comes with Open Wat C/C++.
With something off-topic like this, it might be better
Hi,
If I wanted to print an entire module, skipping the attributes
starting with "__" is there an *optimal* way? Currently I am doing
something like this. Note I am just using sys here to make the point
import sys
data = []
for attr in sys.__dict__.keys():
if not attr.startswith('__') and no
See Subject.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 5, 3:43 pm, Peter Otten <__pete...@web.de> wrote:
> Kristofer Tengström wrote:
> > Thanks everyone, moving the declaration to the class's __init__ method
> > did the trick. Now there's just one little problem left. I'm trying to
> > create a list that holds the parents for each instance in t
"becky_lewis" wrote in message
news:a7cd34d7-ed2b-4449-8edc-a6a45b59e...@hb5g2000vbb.googlegroups.com...
> >
>> > Possibly.
>> > I tried this:
>> > server.py -n -c config.ini
>> > Once again, the server is up and running and when I am logging in with
>> > my
>> > browser (10.0.0.140:8081) I can
Travis Parks writes:
> I also like partial function application. What is the easiest way of
> achieving this in Python? Would it look something like this:
>
> def foo(x, y):
> return x + y
>
> xFoo = lambda y: foo(10, y)
from functools import partial
xfoo = partial(foo, 10)
--
Piet van Oost
On Sep 5, 3:18 pm, Simon Cropper
wrote:
> My investigations have generally found that windows/forms/data entry
> screen can be created for a specific table or view, but these are
> hard-wired during development. Is there anyway of rapidly defining the
> grid during runtime so any table can be view
Chris Torek writes:
[snip]
> Instead, we have a syntax where you, the programmer, write out the
> name of the local variable that binds to the first parameter. This
> means the first parameter is visible. Except, it is only visible
> at the function definition -- when you have the instance and
Thanks everyone, moving the declaration to the class's __init__ method
did the trick. Now there's just one little problem left. I'm trying to
create a list that holds the parents for each instance in the
hierarchy. This is what my code looks like now:
-
cla
Kristofer Tengström wrote:
> Thanks everyone, moving the declaration to the class's __init__ method
> did the trick. Now there's just one little problem left. I'm trying to
> create a list that holds the parents for each instance in the
> hierarchy. This is what my code looks like now:
>
> --
On 05/09/11 23:23, pyt...@bdurham.com wrote:
Check out dabodev.com. Dabo is a Python framework created by former VFP
developers.
Dabo is a great product. Spoke extensively with Ed Leafe and Paul
McNett. Unfortunately the framework is not 'dynamic'. If you have an
fixed database and tables it
Hi Simon,
> I am a applications developer - originally from Windows using primarily
Visual Foxpro, although I am familiar with a variety of other xbase
derivatives.
Check out dabodev.com. Dabo is a Python framework created by former VFP
developers.
Highly recommended.
Malcolm
--
http://mail
On 05/09/11 20:40, Thomas Jollans wrote:
It depends on which windowing toolkit you're planning to use. If you use
PyGTK, you'd want a TreeView widget to display the list. Fill a
ListStore instance with your data and give that to the TreeView. You can
implement filtering and sorting on top of that
On 05/09/11 07:18, Simon Cropper wrote:
> I am looking for the ability to create dynamic grids in a window but
> can't for the life of me find how to do this.
It depends on which windowing toolkit you're planning to use. If you use
PyGTK, you'd want a TreeView widget to display the list. Fill a
Li
On 05/09/11 17:19, Steven D'Aprano wrote:
On Mon, 5 Sep 2011 03:18 pm Simon Cropper wrote:
I am looking for the ability to create dynamic grids in a window but
can't for the life of me find how to do this.
What GUI toolkit are you using?
I have looked at wxGlade, Boa Constructor, wxFormBu
Hi,
You are getting same object because you are overriding the dictionary
update.
Its printing the proper value with the last updated instance of B.
If you want to see the two different instances of class B give print
self.sub inside the sub_add method in class A.
CHEERS
CNA
9986229891
On Mon,
>
> > Possibly.
> > I tried this:
> > server.py -n -c config.ini
> > Once again, the server is up and running and when I am logging in with my
> > browser (10.0.0.140:8081) I can see information showing up at the command
> > prompt, showing somebody is logging is, but the same error:
> > "fshandler
Kristofer Tengström writes:
> Hi, I'm having trouble creating objects that in turn can have custom
> objects as variables.
That terminology is rather confused.
I think what you want is to have instances with their own attributes.
> class A:
> sub = dict()
This binds a single object (a new
On Mon, 5 Sep 2011 03:18 pm Simon Cropper wrote:
> I am looking for the ability to create dynamic grids in a window but
> can't for the life of me find how to do this.
What GUI toolkit are you using?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
Kristofer Tengström wrote:
> Hi, I'm having trouble creating objects that in turn can have custom
> objects as variables. The code looks like this:
>
> -
>
> class A:
> sub = dict()
Putting it into the class like this means sub is shared by all in
On 9/4/11 11:47 PM, Kristofer Tengström wrote:
> Hi, I'm having trouble creating objects that in turn can have custom
> objects as variables. The code looks like this:
>
> -
>
> class A:
> sub = dict()
You are sharing this single "sub" dictionary w
51 matches
Mail list logo