In message , Alex Hall
wrote:
> ... I have about fifteen vars in a function which have to be
> global.
Why not make them class variables, e.g.
class my_namespace :
var1 = ...
var2 = ...
#end my_namespace
def my_function(...) :
... can directly read/assign my
On Sat, 08 May 2010 10:08:08 -0400, Alex Hall wrote:
> Hi all,
> I am sorry if this is the second message about this you get; I typed
> this and hit send (on gmail website) but I got a 404 error, so I am not
> sure if the previous message made it out or not. Anyway, I have about
> fifteen vars in
On 8 May, 16:03, Alex Hall wrote:
> On 5/8/10, Jon Clements wrote:
>
> > On 8 May, 15:08, Alex Hall wrote:
> >> Hi all,
> >> I am sorry if this is the second message about this you get; I typed
> >> this and hit send (on gmail website) but I got a 404 error, so I am
> >> not sure if the previous
On Sun, May 9, 2010 at 12:08 AM, Alex Hall wrote:
> Hi all,
> I am sorry if this is the second message about this you get; I typed
> this and hit send (on gmail website) but I got a 404 error, so I am
> not sure if the previous message made it out or not.
> Anyway, I have about fifteen vars in a f
On 5/8/10, Jon Clements wrote:
> On 8 May, 15:08, Alex Hall wrote:
>> Hi all,
>> I am sorry if this is the second message about this you get; I typed
>> this and hit send (on gmail website) but I got a 404 error, so I am
>> not sure if the previous message made it out or not.
>> Anyway, I have ab
On 8 May, 15:08, Alex Hall wrote:
> Hi all,
> I am sorry if this is the second message about this you get; I typed
> this and hit send (on gmail website) but I got a 404 error, so I am
> not sure if the previous message made it out or not.
> Anyway, I have about fifteen vars in a function which ha
Alex Hall wrote:
Hi all,
I am sorry if this is the second message about this you get; I typed
this and hit send (on gmail website) but I got a 404 error, so I am
not sure if the previous message made it out or not.
Anyway, I have about fifteen vars in a function which have to be
global. Is there
Hi all,
I am sorry if this is the second message about this you get; I typed
this and hit send (on gmail website) but I got a 404 error, so I am
not sure if the previous message made it out or not.
Anyway, I have about fifteen vars in a function which have to be
global. Is there a faster and more s
Dennis Lee Bieber wrote:
On Wed, 27 Aug 2008 16:21:03 -0400, RgeeK <[EMAIL PROTECTED]>
declaimed the following in comp.lang.python:
I have a main module doStuff.py and another module utility.py. At the
start of doStuff.py I call
import utility.py
I hope not... import utility
Fredrik Lundh wrote:
>>import utility.py
> that tries to import a module named "py" from the package "utility".
oops - that was just a typo in my post - I meant of course "import utility"
>
> Python doesn't have "program-wide global" variables; if you need that,
> create a support module and
Fredrik Lundh wrote:
import utility.py
that tries to import a module named "py" from the package "utility".
oops - that was just a typo in my post - I meant of course "import utility"
Python doesn't have "program-wide global" variables; if you need that,
create a support module and impor
RgeeK wrote:
I have a main module doStuff.py and another module utility.py. At the
start of doStuff.py I call
import utility.py
that tries to import a module named "py" from the package "utility".
Then I also proceed to initiallize some global variables
sName = ""
Within my utility.
I have a main module doStuff.py and another module utility.py. At the
start of doStuff.py I call
import utility.py
Then I also proceed to initiallize some global variables
sName = ""
Then I create a class, some methods etc. In one of the methods I assign
a value to my variable sName. Th
Hello all,
Amazing :)
The program is working properly now, the code is much better and I
learned a bit more Python.
Thank you all, guys.
Bruno.
2008/1/4, Peter Otten <[EMAIL PROTECTED]>:
> Bruno Ferreira wrote:
>
> > I wrote a very simple python program to generate a sorted list of
> > lines
Bruno Ferreira wrote:
> I wrote a very simple python program to generate a sorted list of
> lines from a squid access log file.
Now that your immediate problem is solved it's time to look at the heapq
module. It solves the problem of finding the N largest items in a list
much more efficiently. I
On Thu, 03 Jan 2008 11:38:48 -0300, Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of lines
> from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2
Bruno Ferreira wrote:
> When I execute the program _without_ the lines 10 and 11:
>
> 10 if len(topsquid) > 50:
> 11 topsquid = topsquid[0:50]
>
> it runs perfectly.
>
> But if I execute the program _with_ those lines, this exception is thrown:
>
> [EMAIL PROTECTED]:~$ python topsq
Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of
> lines from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2 topsquid = [["0", "0", "0", "0", "0
Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of
> lines from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2 topsquid = [["0", "0", "0", "0", "0"
Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of
> lines from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2 topsquid = [["0", "0", "0", "0", "0"
Hi,
I wrote a very simple python program to generate a sorted list of
lines from a squid access log file.
Here is a simplified version:
##
1 logfile = open ("squid_access.log", "r")
2 topsquid = [["0", "0", "0", "0", "0", "0", "0"]]
3
4 def add_sorted (list):
5
"Méta-MCI" <[EMAIL PROTECTED]> wrote:
> Example, with meta-data (attributs of function) :
>
> def ff(this):
> try:
> this.count=this.count+1
> except:
> this.count=1
> a=1
> b=2
> c=a+b
>
> ff(ff)
> fa=ff
> ff(ff)
> fa(fa)
> print ff.count
>
>
>
> How to im
Méta-MCI wrote:
> If the iterator is extern (to the function), it's like decorator,
> or global var.
Please excuse me, I don't understand your point. I'm not even sure
if both of us speak of the same iterators.
> If it is internal, it's huge, compare to t
Re!
>>> why you didn't use an iterator?
If the iterator is extern (to the function), it's like decorator, or global
var.
If it is internal, it's huge, compare to this.count=this.count+1 (or
this.count+=1)
@+
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Méta-MCI wrote:
> Example, with meta-data (attributs of function) :
Apart from asking what counting "nb call" of a function means, I
wonder why you didn't use an iterator?
> @-salutations
@-less Regards,
Björn
--
BOFH excuse #65:
system needs to be rebooted
--
http://mail.python.org/mail
Re!
I can do :
def ff():
this=ff
try:
this.count=this.count+1
except:
this.count=1
a=1
b=2
c=a+b
ff()
fa=ff
ff()
fa()
print ff.count
But that use, inside the function, the litteral name of the function; and I
want no use litteral name (inside)
@+
Mic
Nick Coghlan wrote:
Michael Hoffman wrote:
raver2046 wrote:
How to have a global var in python ?
"global var" will give you a global variable named "var".
Whether this advice is correct or not depends greatly on what the OP
means by 'global' :)
Module global, it
Michael Hoffman wrote:
raver2046 wrote:
How to have a global var in python ?
"global var" will give you a global variable named "var".
Whether this advice is correct or not depends greatly on what the OP means by
'global' :)
Module global, it's right, appli
raver2046 wrote:
How to have a global var in python ?
You can, but you probably don't want to. What's your use case? Example
code and what you'd like it to do would be helpful.
STeVe
--
http://mail.python.org/mailman/listinfo/python-list
raver2046 wrote:
How to have a global var in python ?
"global var" will give you a global variable named "var".
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
hello,
How to have a global var in python ?
thank you.
raver2046
http://raver2046.ath.cx
--
http://mail.python.org/mailman/listinfo/python-list
31 matches
Mail list logo