Skip Montanaro <[EMAIL PROTECTED]> writes:
> How about (untested):
>
> import Queue
> counter = Queue.Queue()
> counter.put(0)
> def f():
> i = counter.get()
> counter.put(i+1)
> return i
Hmmm, that's a bit messier than I hoped for, but it looks sure to wor
Mike Moum wrote:
> Hi,
>
> I'm a civil engineer who also doubles as chief programmer for
> technical applications at my company. Most of our software is written
> in Visual Basic because our VP in charge of I.T. likes to have
> "consistency", and at the moment we're a Microsoft shop. He has
> assig
Mike Moum wrote:
We have a central server array running Windows Server 2000 (I think
that's the right name; networking is not my specialty, but it's
definately Windows). Some of our workstations run Windows 2000; others
run Windows XP Pro. I would like to install Python on the server, and
run t
[Peter Hansen]
> If py.test provides a driver utility that does
> effectively this, well, that's nice for users. If
> it doesn't run them as separate processes, it wouldn't
> suit me anyway.
>
> Still, it sounds like it does have a strong following
> of smart people: enough to make me want to take
[Peter Hansen]
> This is pretty, but I *want* my tests to be contained
> in separate functions or methods.
In py.test, those would read:
def test1():
assert a == b
def test2():
raises(Error, func, args)
Enclosing classes are optional.
Raymond
--
http://mail.python.org/mailman/listi
Hi,
I am a beginner using the python interpreter. To reduce typing effort,
I created a module called "aliases.py" containing some aliases for
objects I commonly use like -
aliases.py :
import filecmp, os, commands
op = os.path
go = commands.getoutput
dc = filecmp.dircmp
p1 = '/mnt/usbkey/flash
Tim Peters wrote in news:mailman.1223.1112417955.1799.python-
[EMAIL PROTECTED] in comp.lang.python:
> [Paul Rubin]
>> I'd like to have a function (or other callable object) that returns
>> 0, 1, 2, etc. on repeated calls. That is:
>>
>>print f() # prints 0
>>print f() # prints 1
>>
Artie Gold wrote:
Skip Montanaro wrote:
counter = Queue.Queue()
def f():
i = counter.get()
I think you need:
i = counter.get(True)
The default value for the "block" argument to Queue.get is True.
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 02 Apr 2005 09:24:30 GMT, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote:
>[Peter Hansen]
>> If py.test provides a driver utility that does
>> effectively this, well, that's nice for users. If
>> it doesn't run them as separate processes, it wouldn't
>> suit me anyway.
>>
>> Still, it soun
coffeebug wrote:
Newbie here ("new" to the language and scripting in general).
I'm trying to figure out what you mean by bytecode. Do you mean
a virtual python environment that can be hosted by any anonymous
operating system? For example, you want to run Python programs on
BEOS so you crank up i
[EMAIL PROTECTED] wrote:
> Hi,
>
> I am a beginner using the python interpreter. To reduce typing effort,
> I created a module called "aliases.py" containing some aliases for
> objects I commonly use like -
>
> aliases.py :
>
>
> import filecmp, os, commands
>
> op = os.path
> go = commands.g
Skip Montanaro wrote:
Take a look around for Marc Andre Lemburg's pybench suite.
Thanks! Although pybench needs module.re and module.pickle,
so I'll post results later. Moreover, I have similar tests.
I'd prefer scripts that do *real* calculations.
Stelios
--
http://mail.python.org/mailman/list
Paul Rubin wrote:
Skip Montanaro <[EMAIL PROTECTED]> writes:
How about (untested):
import Queue
counter = Queue.Queue()
counter.put(0)
def f():
i = counter.get()
counter.put(i+1)
return i
Hmmm, that's a bit messier than I hoped for, but it looks sure to work
Tim Peters wrote:
[Aahz]
"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code --
not in reams of trivial code that bores the reader to death." --GvR
[Sunnan]
Can anyone please point me to the text that quote wa
Robert Kern wrote:
Sunnan wrote:
(((0.0 < a) < 1.0) < b ) < 2.0
Go on. Try it with a bunch of different values.
My bad. (Of course. The subexpressions must return booleans, not the
largest number. It couldn't work any other way.) Egg on my face, and all
that (figuratively speaking).
Not used to
On 1 Apr 2005 11:58:11 -0800, writeson <[EMAIL PROTECTED]> wrote:
> We've got an application we wrote in Python called pagecrawler that
> Does anyone have any insight if this is a reasonable approach to build web
> pages,
> or if we should look at another design?
I don't have an answer to your p
Hello Simo & NG,
>Correct me if I'm wrong but since it _seems_ that the listing doesn't
>need to be up-to-date each minute/hour as the users will be looking
>primarily for old/unused files, why not have a daily cronjob on the
>Unix server to produce an appropriate file list on e.g. the root
>direc
Sunnan wrote:
...Because what is "boring"? The opposite of dense, tense, intense. Utterly
predictable; it's like the combination of all my prejudices. Even before
I knew, I thought "Bet Python separates statements from expressions".
Python is for terse, pithy prose; Python is not for poetry.
--Sc
Roy Smith wrote:
... How our tools warp our thinking.
That is what it means to be human. I can think of no better reason
for a programmer to regularly learn languages: "our tools warp our
thinking." A programmer is a professionally warped thinker.
--Scott David Daniels
[EMAIL PROTECTED]
--
http:
On Sat, 02 Apr 2005 00:40:15 -0500, Steve Holden <[EMAIL PROTECTED]>
wrote:
>
>The danger in GOTO is that it allows the undisciplined programmer to
>develop a badly-structured solution to a programming problem. A
>disciplined programmer will write well-structured code with whatever
>tools come
Jim Hargrave wrote:
> Hum, maybe my question was too specific. What I would really like to
> know is what is the best way to implement a Python application with a
> pluggable architecture. In particular, I would like to use wxPython and
> have plug ins automatically register themselves with the GU
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Bengt Richter)
> Is there a package that is accessible without svn?
That seems to be its weak point right now.
Fortunately, you can get pre-built svn clients for many platforms
(http://subversion.tigris.org/project_packages.html#binary-packages
Or better yet, define your own string/class exception to catch your
errors. In my code, things can break in more than a few ways. In each
case I catch the exception(s) specific to that piece of code, print a
warning message to the user at sys.stdout and raise a new exception to
be caught by my "w
I was having some difficulty figuring out just what was going on with
decorators. So after a considerable amount of experimenting I was
able to take one apart in a way. It required me to take a closer look
at function def's and call's, which is something I tend to take for
granted.
I'm not sure
[EVALUATION] - E02 - Support for MinGW Open Source Compiler
http://groups-beta.google.com/group/comp.lang.python/msg/f5cd74aa26617f17
-
In comparison to the E02 thread, now a more practical one.
-
Here is a simple evaluation template (first part) which can be applied
to the Python language:
http:
I'm running a PyWin program that executes another program using
subprocess.Popen(). Unfortunately, this other program isn't well
behaved, and frequently terminates without terminating its process.
After this happens enough times, all my memory is tied up, and the
machine crashes.
Using subproces
Edward C. Jones wrote:
I have a program named "octave" (a Matlab clone). It runs in a terminal,
types a prompt and waits for the user to type something. If I try
# Run octave.
oct = subprocess.Popen("octave", stdin=subprocess.PIPE)
# Run an octave called "startup".
oct.communicate("startup")
# Ch
Ron_Adam wrote:
>
> # (0) Read defined functions into memory
>
> def decorator(d_arg): # (7) Get 'Goodbye' off stack
>
> def get_function(function): # (8) Get func object off stack
>
> def wrapper(f_arg):# (9) Get 'Hello' off stack
>
> new_arg = f_arg+'-'+d_arg
>
Roy Smith wrote:
Actually, I believe it does. I'm just starting to play with this, but it
looks like you can do:
py.test test_sample.py
and it'll run a single test file.
Well, my driver script can do that too. I just meant
I could do "test_sample.py" and have it run the test
any time, if I wa
Raymond Hettinger wrote:
[Peter Hansen]
This is pretty, but I *want* my tests to be contained
in separate functions or methods.
In py.test, those would read:
def test1():
assert a == b
def test2():
raises(Error, func, args)
Enclosing classes are optional.
So basically py.test skips the imp
i use this to open/close netscape as it also doesnt like to close all
the time. its a WMI script but easiely edited.
check out script-o-matic from ms-downloads , it outputs python code as
well as others.
##
strComputer = "."
Set o
Leif K-Brooks wrote:
Artie Gold wrote:
Skip Montanaro wrote:
counter = Queue.Queue()
def f():
i = counter.get()
I think you need:
i = counter.get(True)
The default value for the "block" argument to Queue.get is True.
Right. I misparsed the entry in the documentation:
"If
Quoth Scott David Daniels <[EMAIL PROTECTED]>:
| Sunnan wrote:
| > ...Because what is "boring"? The opposite of dense, tense, intense. Utterly
| > predictable; it's like the combination of all my prejudices. Even before
| > I knew, I thought "Bet Python separates statements from expressions".
|
|
Peter Hansen wrote:
max(01)* wrote:
Peter Hansen wrote:
Not required except for performance reasons. If the .pyc
files don't exist, the .py files are recompiled and the
resulting bytecode is simply held in memory and not cached
and the next startup will recompile all over again.
but the other fil
Hi,
In my attempted learning of python, I've decided to recode an old
anagram solving program I made in C++. The C++ version runs in less
than a second, while the python takes 30 seconds. I'm not willing to
think it's just python being slow, so I was hoping someone could find
a faster way of doing
hi.
is there a way to define a class method which prints the instance name?
e.g.:
>>> class class_1:
... def myName(self):
... what should i do here
...
>>> instance_1 = class_1()
>>> instance_1.myName()
'instance_1'
>>>
bye
macs
--
http://mail.python.org/mailman/listinfo/python-list
"max(01)*" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> is there a way to define a class method which prints the instance name?
The term "the instance name" is misleading, because it assumes, without
saying so explicitly, that every instance has a unique name.
In fact, there i
max(01)* wrote:
> hi.
>
> is there a way to define a class method which prints the instance name?
>
> e.g.:
>
class class_1:
> ... def myName(self):
> ... what should i do here
> ...
instance_1 = class_1()
instance_1.myName()
> 'instance_1'
>
> bye
>
> macs
W
Andrew Koenig wrote:
"max(01)*" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
is there a way to define a class method which prints the instance name?
The term "the instance name" is misleading, because it assumes, without
saying so explicitly, that every instance has a unique nam
Irmen de Jong wrote:
max(01)* wrote:
hi.
is there a way to define a class method which prints the instance name?
e.g.:
class class_1:
... def myName(self):
... what should i do here
...
instance_1 = class_1()
instance_1.myName()
'instance_1'
bye
macs
What should the following do, yo
Hello,
Here is some sample code with pywin32 build 203 and ctypes 0.9.6.
Best regards,
/Srijit
File: SharedMemCreate_Mutex_win32all.py
# This application should be used with SharedMemAccess_Mutex_ctypes.py
or SharedMemAccess_Mutex_win32all.py
#~ a) Creates a shared memory
#~ b) Creates or Opens
Tom Carrick wrote:
> Hi,
>
> In my attempted learning of python, I've decided to recode an old
> anagram solving program I made in C++. The C++ version runs in less
> than a second, while the python takes 30 seconds. I'm not willing to
> think it's just python being slow, so I was hoping someone c
In article <[EMAIL PROTECTED]>,
Sunnan <[EMAIL PROTECTED]> wrote:
>>> [Aahz]
"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code --
not in reams of trivial code that bores the reader to death.
In <[EMAIL PROTECTED]>, Tom Carrick
wrote:
> [â] Also, I was wondering if there was a more
> builtin, or just nicer way of converting a string to a list (or using
> the sort function on a list) than making a function for it.
Use the `list()` builtin on the string and *just* the `sort()` method::
In <[EMAIL PROTECTED]>, Irmen de Jong wrote:
>> words = file.splitlines()
>
> You can obtain this list without reading the file in its entirety,
> by using the readlines method of file objects:
>
> words=open("words.txt").readlines()
This leaves the newline characters at the end of each line wh
Ron_Adam wrote:
> def decorator(d_arg): # (7) Get 'Goodbye' off stack
>
> def get_function(function): # (8) Get func object off stack
>
> def wrapper(f_arg):# (9) Get 'Hello' off stack
>
> new_arg = f_arg+'-'+d_arg
> result = function(new_arg) # (10
"Tom Carrick" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
| Hi,
|
| In my attempted learning of python, I've decided to recode an old
| anagram solving program I made in C++. The C++ version runs in less
| than a second, while the python takes 30 seconds. I'm not willing to
|
Tom Carrick <[EMAIL PROTECTED]> writes:
> In my attempted learning of python, I've decided to recode an old
> anagram solving program I made in C++. The C++ version runs in less
> than a second, while the python takes 30 seconds.
Indeed, your program can be improved to run about ten times as fast
On 2 Apr 2005 07:22:39 -0800, "El Pitonero" <[EMAIL PROTECTED]>
wrote:
>Is it possible that you mistakenly believe your @decorator() is being
>executed at the line "func('Hello')"?
>
>Please add a print statement to your code:
>
>def decorator(d_arg):
> def get_function(function):
> pr
Scott David Daniels wrote:
Roy Smith wrote:
... How our tools warp our thinking.
That is what it means to be human. I can think of no better reason
for a programmer to regularly learn languages: "our tools warp our
thinking." A programmer is a professionally warped thinker.
--Scott David Daniels
In article <[EMAIL PROTECTED]>,
Skip Montanaro <[EMAIL PROTECTED]> wrote:
>
>Obviously, if you want multiple counters for some reason a little
>information hiding with a class would help (also untested):
>
>import Queue
>
>class Counter:
>def __init__(self, start=0):
>s
> statements documenting the flow in a few minutes. I'm still a bit
> fuzzy on how the arguments are stored and passed.
The arguments are part of the outer scope of the function returned, and thus
they ar kept around. That's standart python,too:
def foo():
a = 10
def bar():
return
What is the name of the IDLE program on Linux and where is it installed
in a normal Linux distribution ? I have installed all the Python 2.3.5
RPMs on my Fedora 3 system but I have no idea where they are installed
or what IDLE is called. I lloked in the Python web pages to try to find
a list of
Thomas Rast wrote:
Tom Carrick <[EMAIL PROTECTED]> writes:
In my attempted learning of python, I've decided to recode an old
anagram solving program I made in C++. The C++ version runs in less
than a second, while the python takes 30 seconds.
Indeed, your program can be improved to run about ten ti
It turns out it's not a "how to inflate tires with a hammer" request;
I've actually written an optional type checking module using
decorators. The implementation details are not easy to grok, but the
usage is straightforward:
from typecheck import *
@returns(listOf(int, size=3))
@expects(x=str, y=
Tom Carrick wrote:
Hi,
In my attempted learning of python, I've decided to recode an old
anagram solving program I made in C++. The C++ version runs in less
than a second, while the python takes 30 seconds. I'm not willing to
think it's just python being slow, so I was hoping someone could find
a f
On Sat, 2 Apr 2005, Edward Diener wrote:
> What is the name of the IDLE program on Linux and where is it installed
> in a normal Linux distribution ? I have installed all the Python 2.3.5
> RPMs on my Fedora 3 system but I have no idea where they are installed
> or what IDLE is called. I lloked
On Sat, 02 Apr 2005 19:59:30 +0200, "Diez B. Roggisch"
<[EMAIL PROTECTED]> wrote:
>> statements documenting the flow in a few minutes. I'm still a bit
>> fuzzy on how the arguments are stored and passed.
>
>The arguments are part of the outer scope of the function returned, and thus
>they ar kept
Donn Cave wrote:
Quoth Scott David Daniels <[EMAIL PROTECTED]>:
| Sunnan wrote:
| > ...Because what is "boring"? The opposite of dense, tense, intense. Utterly
| > predictable; it's like the combination of all my prejudices. Even before
| > I knew, I thought "Bet Python separates statements from
Tom Carrick wrote:
Hi,
In my attempted learning of python, I've decided to recode an old
anagram solving program I made in C++. The C++ version runs in less
than a second, while the python takes 30 seconds. I'm not willing to
think it's just python being slow, so I was hoping someone could find
a f
Scott David Daniels wrote:
if __name__ == '__main__':
import sys
main(sys.argv[1:] or ['anagrams.py'])
This is *exactly* the kind of testcases I'm looking for to test
the soon-to-be-released pyvm. Great! I'll be back with results.
For now, a fast anagrams.py is
---
> I followed that part. The part that I'm having problems with is the
> first nested function get's the argument for the function name without
> a previous reference to the argument name in the outer frames. So, a
> function call to it is being made with the function name as the
> argument, and th
In article <[EMAIL PROTECTED]>,
Ivan Van Laningham <[EMAIL PROTECTED]> wrote:
.
.
.
>> >>> 25
>> 25
>> >>> (_ | _)
>> 25
>> >>>
>>
>> There's clearly some interesting biometrics research to be done here,
>> although there is
> "Cesar" == Cesar Andres Roldan Garcia <[EMAIL PROTECTED]> writes:
Cesar> Hi How can I control an ALU from a PC using Python?
Cesar> Thanks!
Cesar> Hola...
Cesar> Como puedo controlar la ALU de un PC usando Pyhton?
Cesar> Gracias!
Cesar> -- Atentamente,
Cesa
[EMAIL PROTECTED] writes:
> >$ find . -type f -printf "%T@ %u %s %p\n" > /yourserverroot/files.txt
> That is a nice idea. I don't know very much about Unix, but I suppose that
> on a ksh I can run this command (or a similar one) in order to obtain the
> list I need. If anyone knows if that command
On 2 Apr 2005 08:39:35 -0800, "Kay Schluehr" <[EMAIL PROTECTED]>
wrote:
>
>There is actually nothing mysterious about decorators.
I've heard this quite a few times now, but *is* quite mysterious if
you are not already familiar with how they work. Or instead of
mysterious, you could say complex,
Is that last idea so stupid? Still, I'd like to know if you know some
little Python search engines for such purpose.
Thank you,
Bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Hi All--
Cameron Laird wrote:
>
> Welcome back, Ivan. Your follow-ups make one wonder about the
> span of related topics clp has been missing in your absence.
>
Thanks for the welcome. Absence was more a consequence of working for
idiots for four years (at 60-80 hours/week) than anything else.
Jim Benson wrote:
On Sat, 2 Apr 2005, Edward Diener wrote:
What is the name of the IDLE program on Linux and where is it installed
in a normal Linux distribution ? I have installed all the Python 2.3.5
RPMs on my Fedora 3 system but I have no idea where they are installed
or what IDLE is called
[EMAIL PROTECTED] (Aahz) writes:
> This is one case where'd recommend using a plan RLock() instead of using
> Queue -- the RLock() will be more efficient...
I'm starting to believe the GIL covers up an awful lot of sloppiness
in Python. I wonder if there could be a decorator approach:
@synch
Ron_Adam wrote:
> On 2 Apr 2005 08:39:35 -0800, "Kay Schluehr" <[EMAIL PROTECTED]>
> wrote:
>
> >There is actually nothing mysterious about decorators.
>
> I've heard this quite a few times now, but *is* quite mysterious if
> you are not already familiar with how they work. Or instead of
> mysteri
Hi all,
I'm just starting to employ unit testing (I'm using doctest), and I am
uncertain how to handle writing tests where the behaviour being tested
is dependant on whether certain file paths point to actual files.
I have a class which takes, in its __init__, a list of file paths to
process. The
On Sat, 02 Apr 2005 21:04:57 +0200, "Diez B. Roggisch"
<[EMAIL PROTECTED]> wrote:
>> I followed that part. The part that I'm having problems with is the
>> first nested function get's the argument for the function name without
>> a previous reference to the argument name in the outer frames. So,
On Sat, 02 Apr 2005 18:39:41 GMT, Ron_Adam <[EMAIL PROTECTED]>
wrote:
>>def foo():
>>a = 10
>>def bar():
>> return a*a
>>return bar
>>
>>print foo()() <--- *Here*
>>
>>
>>No decorator-specific magic here - just references kept to outer frames
>>which form the scope
In <[EMAIL PROTECTED]>, Tom Carrick
wrote:
> In my attempted learning of python, I've decided to recode an old
> anagram solving program I made in C++. The C++ version runs in less
> than a second, while the python takes 30 seconds. I'm not willing to
> think it's just python being slow, so I was
Edward Diener <[EMAIL PROTECTED]> writes:
> It is a pity the Python Linux binary installations do not
> create folders on the desktop or in the Gnome menu system with links
> to the Python to the documentation and a readme telling me what
> executables were installed.
Imagine they did, and the ot
On Sat, 02 Apr 2005 14:29:08 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote:
>
>I was having some difficulty figuring out just what was going on with
>decorators. So after a considerable amount of experimenting I was
>able to take one apart in a way. It required me to take a closer look
>at function de
* Brian van den Broek wrote:
> The relevant part of the validation method code looks like:
>
> # self.universe_files is a list of file paths
> non_existent_files = [ x for x in self.universe_files if
> not os.path.isfile(x) ]
> if non_existen
On Sat, 02 Apr 2005 10:29:19 -0800, Shalabh Chaturvedi <[EMAIL PROTECTED]>
wrote:
>Tom Carrick wrote:
>> Hi,
>>
>> In my attempted learning of python, I've decided to recode an old
>> anagram solving program I made in C++. The C++ version runs in less
>> than a second, while the python takes 30
Marc 'BlackJack' Rintsch wrote:
def make_anagram_map(words):
anagram_map = dict()
for word in imap(lambda w: w.strip().lower(), words):
sorted_word = ''.join(sorted(list(word)))
anagram_map.setdefault(sorted_word, list()).append(word)
return dict(ifilter(lambda x: l
On Sat, 02 Apr 2005 21:04:57 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:
>> I followed that part. The part that I'm having problems with is the
>> first nested function get's the argument for the function name without
>> a previous reference to the argument name in the outer frames. So,
"max(01)*" <[EMAIL PROTECTED]> writes:
> Peter Hansen wrote:
>> max(01)* wrote:
>>
>>> hi everybody.
>>>
>>> suppose that code-1.py imports code-2.py and code-3.py (because it
>>> uses names from both), and that code-2.py imports code-3.py.
>>>
>>> if python were c, code-1.c should only *include*
[Paul Rubin]
> I'm starting to believe the GIL covers up an awful lot of sloppiness
> in Python.
The GIL is highly exploitable, and much of CPython does exploit it.
If you don't want to exploit it, that's fine: there was always an
obvious approach using an explicit mutex here, and the only thing
your script works ok on my W2K box :-).
It makes me curious if I can get also the
temperatures into Python script for
further processing as easy as the setting
of the checkbox is done? (I have not
much experience with this kind of
programming yet)
May I ask how did you get the
"TJvXPCheckbox" and
Hello Ron ,
You have many good explanations already, but I thought that this
__might__ help others.
Like you I was confused by the decorator syntax. till I realized it was
shorthand for ...
def identity(f):
return f
def foo():
pass
# this is the 'old way'
foo = identity(foo)
It just re
Am Samstag, 2. April 2005 22:28 schrieb Paul Rubin:
> I'm starting to believe the GIL covers up an awful lot of sloppiness
> in Python. I wonder if there could be a decorator approach:
>
> @synchronized
> def counter():
>t = itertools.count()
>while True:
> yield t
Am Sonntag, 3. April 2005 00:57 schrieb Heiko Wundram:
>
> or
Make that:
create_counter = syncronized_iterator(itertools.count)
and
counter = create_counter()
to create the actual counter regardless of iterator.
--
--- Heiko.
pgpuQ5CRv1IKe.pgp
Description: PGP signature
--
http://mail.py
Tim Peters <[EMAIL PROTECTED]> writes:
> If you don't want to exploit it, that's fine: there was always an
> obvious approach using an explicit mutex here, and the only thing
> stopping you from using it is a desire to be clever. Exploiting the
> GIL in CPython is clever; using an explicit mutex
max(01)* wrote:
hi.
is there a way to define a class method which prints the instance name?
e.g.:
>>> class class_1:
... def myName(self):
... what should i do here
...
>>> instance_1 = class_1()
>>> instance_1.myName()
'instance_1'
>>>
bye
macs
macs,
The object instance doesn't k
Andreas Beyer <[EMAIL PROTECTED]> writes:
> OK, you won. I read in an (regretably old) guidline for improving
> Python's performance that you should prefer map() compared to list
> comprehensions. Apparently the performance of list comprehensions has
> improved a lot, which is great. (Or the overh
Can't you use the tempfile module to generate unique names for
non-existent files and directories? Take a look at
http://www.python.org/doc/lib/module-tempfile.html -- it works on all
supported platforms.
Grig
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 02 Apr 2005 21:28:36 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>I think it might help you to start out with very plain decorators rather than
>decorators as factory functions that return decorator functions that wrap the
>decorated function in a wrapper function. E.g., (this could obvi
Hi,
I am trying to treat an environment variable as a python list - and I'm
sure there must be a standard and simple way to do so. I know that the
interpreter itself must use it (to process $PATH / %PATH%, etc) but I
am not able to find a simple function to do so.
os.environ['PATH'].split(os.sep)
On Sat, 02 Apr 2005 15:30:13 -0500, Brian van den Broek wrote:
> So, how does one handle such cases with tests?
When I had a similar situation, I created a directory for testing that was
in a known state, and tested on that. If you can test based on a relative
directory, that should work OK.
Non-
chirayuk wrote:
Hi,
I am trying to treat an environment variable as a python list - and I'm
sure there must be a standard and simple way to do so. I know that the
interpreter itself must use it (to process $PATH / %PATH%, etc) but I
am not able to find a simple function to do so.
os.environ['PATH']
Thomas Rast wrote:
> Edward Diener <[EMAIL PROTECTED]> writes:
>
>> It is a pity the Python Linux binary installations do not
>> create folders on the desktop or in the Gnome menu system with links
>> to the Python to the documentation and a readme telling me what
>> executables were installed.
>
>
On Sat, 02 Apr 2005 16:44:29 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote:
>"max(01)*" <[EMAIL PROTECTED]> writes:
>
>> Peter Hansen wrote:
>>> max(01)* wrote:
>>>
hi everybody.
suppose that code-1.py imports code-2.py and code-3.py (because it
uses names from both), and that co
On 2 Apr 2005 10:23:53 -0800, "George Sakkis" <[EMAIL PROTECTED]>
wrote:
>It turns out it's not a "how to inflate tires with a hammer" request;
>I've actually written an optional type checking module using
>decorators. The implementation details are not easy to grok, but the
>usage is straightforw
Jeremy Bowers wrote:
> On Fri, 01 Apr 2005 14:20:51 -0800, RickMuller wrote:
>
> > I'm trying to split a string into pieces on whitespace, but I want
to
> > save the whitespace characters rather than discarding them.
> >
> > For example, I want to split the string '12' into ['1','
','2'].
> > I
On Sat, 02 Apr 2005 15:48:21 GMT, "max(01)*" <[EMAIL PROTECTED]> wrote:
>hi.
>
>is there a way to define a class method which prints the instance name?
>
>e.g.:
>
> >>> class class_1:
>... def myName(self):
>... what should i do here
>...
> >>> instance_1 = class_1()
> >>> instance_1
1 - 100 of 115 matches
Mail list logo