On 3/14/2011 8:49 PM, Yaşar Arabacı wrote:
As I try to implement things with getattr, I am getting a really
strange error. This is my file:
Various interspersed comments:
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
class global_variables:
It is customary to start class names with an uppe
> "R. Alan Monroe" wrote
>> Neither of these seem like they'd scale very well (say, up to the
>> resolution of your screen, with one block per pixel). The end goal
>> is
>> just a basic do-nothing light show that simulates
>> fragmentation/defragmentation as eye candy.
> For that purpose the
As I try to implement things with getattr, I am getting a really strange
error. This is my file:
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
class global_variables:
"Holds class attributes, so that other classes can share them"
products = 0
best_bundle = []
class dispa
Yaşar Arabacı wrote:
And What I want to do is a small economy application. It will work this
way:
user add a product name, rate how much it like it over 10, and enter its
price.
[repeated as many times as wanted]
user will enter h(is|er) budget.
user will use "calcute bundle" to show much
Before being able to see 3rd answer, I did something like this and it
worked for me:
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
def command_dispatcher():
"Takes comman line arguments and executes regardin method"
command = raw_input(">>>")
args = command.split(" ")
Marc Tompkins wrote:
On Mon, Mar 14, 2011 at 1:02 PM, Marc Tompkins wrote:
On Mon, Mar 14, 2011 at 12:59 PM, paige crawford <
plcrawf...@crimson.ua.edu> wrote:
How do I split them by spaces?
Google "Python split".
That might have been a bit abrupt... but (in general) the Tutor list is
happ
Prasad, Ramit wrote:
Take a look at:
http://stackoverflow.com/questions/701802/how-do-i-execute-a-string-containing-python-code-in-python
And then please don't do it. eval and exec should be treated as the last
resort, and then only if you really know what you are doing. They are
slow, and da
Yaşar Arabacı wrote:
Hi
I am trying to do something like this:
If you are trying to write a mini-language, the ``cmd`` and ``shlex``
modules in the standard library may be useful to you.
#!/usr/bin/env python
def command_dispatcher():
"Takes comman line arguments and executes regardi
Take a look at:
http://stackoverflow.com/questions/701802/how-do-i-execute-a-string-containing-python-code-in-python
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
-Original Message-
From: tu
Hi
I am trying to do something like this:
#!/usr/bin/env python
def command_dispatcher():
"Takes comman line arguments and executes regardin method"
command = raw_input(">>>")
args = command.split(" ")
args[0].args[1]
class calculate:
def bundle(self):
On 3/14/2011 3:13 PM, Mike Franon wrote:
Thank you everyone who responded, very fast responses I am impressed.
OK now I see where I went wrong and had to do
if (i == 'test1') or (i=='test2'):
I guess I was thinking if I do
a = ['test1', 'flag', 'monday']
for i in a:
It would check each it
On 3/14/2011 1:13 PM Mike Franon said...
Thank you everyone who responded, very fast responses I am impressed.
OK now I see where I went wrong
Well, no, I don't think so. Your first test was:
if i=='test1' or 'test2':
which evaluates as true if _either_ i=='test1' _or_ 'test2'
so, the fi
Thank you everyone who responded, very fast responses I am impressed.
OK now I see where I went wrong and had to do
if (i == 'test1') or (i=='test2'):
I guess I was thinking if I do
a = ['test1', 'flag', 'monday']
for i in a:
It would check each item in the list one at a time like a loop I
On Mon, Mar 14, 2011 at 1:02 PM, Marc Tompkins wrote:
> On Mon, Mar 14, 2011 at 12:59 PM, paige crawford <
> plcrawf...@crimson.ua.edu> wrote:
>
>> How do I split them by spaces?
>>
>> Google "Python split".
>
> That might have been a bit abrupt... but (in general) the Tutor list is
happy to help
On Mon, Mar 14, 2011 at 12:41 PM, Mike Franon wrote:
> HI,
>
> I had a question, when running this small snippet of test code:
>
>
>
> a = ['test1', 'flag', 'monday']
>
> for i in a:
>if i == 'test1' or 'test2':
> print 'true'
>
>
> It always prints true
>
>
> $ ./testing.py
> true
> tr
On Mon, Mar 14, 2011 at 12:08 PM, paige crawford
wrote:
> Hey,
>
>
> How do I read in a data file that has comments then remove the comments to
> get to the numbers? The numbers in the data file needs to be read into a
> list. There are also comments next to the numbers. The file looks something
>
On 14/03/11 19:41, Mike Franon wrote:
HI,
I had a question, when running this small snippet of test code:
a = ['test1', 'flag', 'monday']
for i in a:
if i == 'test1' or 'test2':
print 'true'
It always prints true
$ ./testing.py
true
true
true
I know I am missing something,
On 03/14/2011 03:41 PM, Mike Franon wrote:
> HI,
>
> I had a question, when running this small snippet of test code:
>
>
>
> a = ['test1', 'flag', 'monday']
>
> for i in a:
> if i == 'test1' or 'test2':
if i == 'test1' or i == 'test2'
>print 'true'
> I know I am missing something
HI,
I had a question, when running this small snippet of test code:
a = ['test1', 'flag', 'monday']
for i in a:
if i == 'test1' or 'test2':
print 'true'
It always prints true
$ ./testing.py
true
true
true
I know I am missing something, but in reality it should only print
true
Hey,
How do I read in a data file that has comments then remove the comments to
get to the numbers? The numbers in the data file needs to be read into a
list. There are also comments next to the numbers. The file looks something
like this
# DO NOT MODIFY
#
# This file is for the eyebrows
#
# Re
Apologies to all, I didn't notice the [] around a.
But the basic point remains that the list that he is appending
to is the same list as b refers to, albeit indirectly. He is still
"touching" the list. Although not directly modifying the list
to which b refers, since it still only holds one mem
On Mon, Mar 14, 2011 at 9:56 AM, Alan Gauld wrote:
> "Yasar Arabaci" wrote
>
>> >>> a=["a"]
>> >>> b=[a]
>> >>> a.append("c")
>> >>> b
>> [['a', 'c']]
>>
>> Apperantly, I can change something (which is mutable) inside a list
>> without even touching the list itself :)
>
> But the point is that y
Alan Gauld wrote:
> "Yasar Arabaci" wrote
>
>> >>> a=["a"]
>> >>> b=[a]
>> >>> a.append("c")
>> >>> b
>> [['a', 'c']]
>>
>> Apperantly, I can change something (which is mutable) inside a list
>> without even touching the list itself :)
>
> But the point is that you *are* touching the list.
> In
On Mon, Mar 14, 2011 at 8:56 AM, Alan Gauld wrote:
> "Yasar Arabaci" wrote
>> Apperantly, I can change something (which is mutable) inside a list
>> without even touching the list itself :)
> But the point is that you *are* touching the list.
> In this case you have two names referring to the sa
"Yasar Arabaci" wrote
>>> a=["a"]
>>> b=[a]
>>> a.append("c")
>>> b
[['a', 'c']]
Apperantly, I can change something (which is mutable) inside a list
without even touching the list itself :)
But the point is that you *are* touching the list.
In this case you have two names referring to the
25 matches
Mail list logo