vino19 wrote:
Sure, I understand that "is" is not "==", cause "is" just compares id(a)==id(b).
I have a win32 CPython and the range of "singletons" is from -5 to 256 on my machine.
I am asking about what happens in Python interpreter? Why is there a difference between running one
line like "
Alec Taylor wrote:
Good Afternoon,
I'm looking for an IDE which offers syntax-highlighting,
code-completion, tabs, an embedded interpreter and which is portable
(for running from USB on Windows).
Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png
Which would you rec
Larry Hastings wrote:
The problem: if you're currently in a nested class, you can't look up
variables in the outer "class scope".
For example, this code fails in Python 3:
class Outer:
class Inner:
class Worker:
pass
class InnerSubclass(Inner):
clas
Gabriel Novaes wrote:
Hello community
My name is Gabriel. I'am from Brazil. 27. I finished last year
Degree in Computer Engineering and I would go to the U.S.A
to learn the local language.
I wonder how is the market for developers, which
city is best for this?
I program for 5 years PHP (MVC) a
VGNU Linux wrote:
Hi All,
I have two chips one understands Python and the other embedded C.I
have connected both chips using UART serial communication channel,
however I have no idea how data communication must be achieved between
this 2 chips. As for example send using C chip string "Hello Py
Raymond Hettinger wrote:
On Mar 31, 3:14 pm, Ben Finney wrote:
Howdy all,
I want to inherit from a class, and define aliases for many of its
attributes. How can I refer to “the attribute that will be available by
name ‘spam’ once this class is defined”?
class Foo(object):
def s
monkeys paw wrote:
How do i delete a module namespace once it has been imported?
I use
import banner
Then i make a modification to banner.py. When i import it again,
the new changes are not reflected. Is there a global variable i can
modify?
It depends on what you want to achieve.
1/ if you
Steven D'Aprano wrote:
On Fri, 25 Mar 2011 10:21:35 +0100, Antoon Pardon wrote:
On Thu, Mar 24, 2011 at 11:49:53PM +, Steven D'Aprano wrote:
On Thu, 24 Mar 2011 17:47:05 +0100, Antoon Pardon wrote:
However since that seems to be a problem for you I will be more
detailed. T
Jean-Michel Pichavant wrote:
Seldon wrote:
On 03/25/2011 12:05 AM, Steven D'Aprano wrote:
On Thu, 24 Mar 2011 19:39:21 +0100, Seldon wrote:
Hi, I have a question about generating variable assignments
dynamically.
[...]
Now, I would like to use data contained in this list to dynami
Seldon wrote:
On 03/25/2011 12:05 AM, Steven D'Aprano wrote:
On Thu, 24 Mar 2011 19:39:21 +0100, Seldon wrote:
Hi, I have a question about generating variable assignments
dynamically.
[...]
Now, I would like to use data contained in this list to dynamically
generate assignments of the form "
Seldon wrote:
Hi, I have a question about generating variable assignments dynamically.
I have a list of 2-tuples like this
(
(var1, value1),
(var2, value2),
.. ,
)
where var1, var2, ecc. are strings and value1, value2 are generic
objects.
Now, I would like to use data contained in this list
Martin De Kauwe wrote:
On Mar 21, 9:43 pm, Jean-Michel Pichavant
wrote:
Martin De Kauwe wrote:
Sorry, are you trying to say that it is not practical to write correct
code that isn't buggy? Well, you're honest, at least, still I can't help
but feel that you're adm
Martin De Kauwe wrote:
Sorry, are you trying to say that it is not practical to write correct
code that isn't buggy? Well, you're honest, at least, still I can't help
but feel that you're admitting defeat before even starting.
No. What I am saying is the code is written has been well teste
monkeys paw wrote:
OK, i overlooked that and the error was not very enlightening.
Thanks very much.
"module.__init__() takes at most 2 arguments (3 given)"
Are you sure about the clueless error message ? :)
JM
--
http://mail.python.org/mailman/listinfo/python-list
Martin De Kauwe wrote:
Hi,
if one has a set of values which should never step outside certain
bounds (for example if the values were negative then they wouldn't be
physically meaningful) is there a nice way to bounds check? I
potentially have 10 or so values I would like to check at the end of
e
Neal Becker wrote:
Robert Kern wrote:
On 3/15/11 9:54 AM, Neal Becker wrote:
Is there any way to tell if an arg value was defaulted vs. set on command
line?
No. If you need to determine that, don't set a default value in the
add_argument() method. Then just check for None and r
Steven D'Aprano wrote:
On Mon, 14 Mar 2011 12:10:27 +0100, Jean-Michel Pichavant wrote:
Steven D'Aprano wrote:
The removal of cmp from the sort method of lists is probably the most
disliked change in Python 3. On the python-dev mailing list at the
moment, Guido is consideri
Steven D'Aprano wrote:
The removal of cmp from the sort method of lists is probably the most
disliked change in Python 3. On the python-dev mailing list at the
moment, Guido is considering whether or not it was a mistake.
If anyone has any use-cases for sorting with a comparison function that
Gerald Britton wrote:
Today I noticed that an expression like this:
"one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
"can be as bad as one"}
could be evaluated at compile time, but is not:
dis(compile(
... '"one:%(one)s two:%(two)s" % {"one": "is the lonelies
bukzor wrote:
We've been doing a fair amount of Python scripting, and now we have a
directory with almost a hundred loosely related scripts. It's
obviously time to organize this, but there's a problem. These scripts
import freely from each other and although code reuse is generally a
good thing
Peter Otten wrote:
Jean-Michel Pichavant wrote:
I'm trying to autoexpand values as well as arguments using the builtin
cmd.Cmd class.
I.E.
Consider the following command and arguments:
> sayHello target=Georges
'Hello Georges !'
I can easily make 'tar' expan
Hello folks,
I'm trying to autoexpand values as well as arguments using the builtin
cmd.Cmd class.
I.E.
Consider the following command and arguments:
> sayHello target=Georges
'Hello Georges !'
I can easily make 'tar' expand into 'target=' however I'd like to be
able to expand the value as
Victor Paraschiv wrote:
Well, thank you all for being honest ☺
What I conclude is that you, the programmers, don’t really care about
those who are new to programming: for most people out of the
programming world, I think it is simpler to be able to write: real(z),
just as you write: sin(z
Vincent Ren wrote:
Hello, everyone, recently I am trying to learn python's
multiprocessing, but
I got confused as a beginner.
[SNIP]
httplib.InvalidURL: nonnumeric port: ''
Regards
Vincent
It's a mistake many beginners do, I don't understand why, but it's a
very common thing. RTFM should
Matt Funk wrote:
Hi Grant,
first of all sorry for the many typos in my previous email.
To clarify, I have a python list full of file names called 'files'.
Every single filename has extension='.hdf' except for one file which has
an '.hdf5' extension. When i do (and yes, this is pasted):
f
Steven Howe wrote:
If an item is None: if ( type(x) == types.NoneType ):
Bye the way, the beauty of python is that "If an item is None"
translates into "If item is None".
JM
--
http://mail.python.org/mailman/listinfo/python-list
jmoons wrote:
I need some help figuring out how to execute this python code from
python -c
I am have trouble formatting python so that it will execute for
another app in cmd I understand there maybe other ways to do what I am
doing but I am limited by the final execution using cmd python -c so
pl
monkeys paw wrote:
I'm trying to subclass urllib2 in order to mask the
version attribute. Here's what i'm using:
import urllib2
class myURL(urllib2):
def __init__(self):
urllib2.__init__(self)
self.version = 'firefox'
I get this>
Traceback (most recent call last):
File ""
Marc Muehlfeld wrote:
Hi,
I'm doing my first steps with python and I have a problem with
understanding an encoding problem I have. My script:
import os
os.environ["NLS_LANG"] = "German_Germany.UTF8"
import cx_Oracle
connection = cx_Oracle.Connection("username/password@SID")
cursor = connectio
christian schulze wrote:
Hey guys,
I just found out, how much Python fails on simple math. I checked a
simple equation for a friend.
[code]
from math import e as e
from math import sqrt as sqrt
2*e*sqrt(3) - 2*e == 2*e*(sqrt(3) - 1)
e has no accurate representation in computer science. Nei
Steven D'Aprano wrote:
On Mon, 21 Feb 2011 14:23:10 +0100, Jean-Michel Pichavant wrote:
What is not legit, is to return different objects for which the caller
has to test the type to know what attributes he can use.
Well, I don't know... I'm of two minds.
On the one
alex23 wrote:
Jean-Michel Pichavant wrote:
You simply don't return inconsistent types with a return statement. This
is a general rule in programming that has probably exceptions but
regarding what you're saying, you clearly don't want to do that.
I don't think t
spam head wrote:
I'm looking for an easy way to display simple line graphs generated by
a python program in Windows. It could be done from within the
program, or I could write the information out to a file and call an
external program. Either is fine.
Does anybody have any recommendations for
Santiago Caracol wrote:
Hello,
a server program of mine uses data which are compiled to a Python
module for efficiency reasons. In some module of the server program I
import the data:
from data import data
As the data often changes, I would like to reimport it every n (e.g.
10) seconds.
Unfor
Steven D'Aprano wrote:
On Thu, 17 Feb 2011 12:02:28 +0100, Jean-Michel Pichavant wrote:
Karim wrote:
[snip]
If you don't want to use a factory function I believe you can do this:
class MyNumber(object):
def __new__(cls, n):
if n<= 100:
snorble wrote:
I use Python a lot, but not well. I usually start by writing a small
script, no classes or modules. Then I add more content to the loops,
and repeat. It's a bit of a trial and error learning phase, making
sure I'm using the third party modules correctly, and so on. I end up
with a
Karim wrote:
[snip]
If you don't want to use a factory function I believe you can do this:
class MyNumber(object):
def __new__(cls, n):
if n<= 100:
cls = SmallNumbers
else:
cls = BigNumbers
return object.__new__(cls, n)
...
Chard.
s...@uce.gov wrote:
How can I do something like this in python:
#!/usr/bin/python3.1
class MyNumbers:
def __init__(self, n):
self.original_value = n
if n <= 100:
self = SmallNumers(self)
else:
self = BigNumbers(self)
class SmallNumbers:
def __init__(self, n):
se
Dan Lee wrote:
Hi.
I just knew what python is.
Now I'm about to write backup script.Now I got 2 scripts.
AAA : generate zip file
BBB : delete old file.
AAA is done.
Now I'm going to code BBB file. and I will fix AAA to call BBB to
delete dump file at the end.
Please let me know How can I call
Martin De Kauwe wrote:
Hi,
I have a series of parameter values which i need to pass throughout my
code (>100), in C I would use a structure for example. However in
python it is not clear to me if it would be better to use a dictionary
or build a class object? Personally I think accessing the val
Yang Zhang wrote:
On Wed, Feb 9, 2011 at 11:01 AM, MRAB wrote:
On 09/02/2011 01:59, Yang Zhang wrote:
I reduced a problem I was seeing in my application down into the
following test case. In this code, a parent process concurrently
spawns 2 (you can spawn more) subprocesses that read a
Josh English wrote:
I found the code posted at
http://infix.se/2007/02/06/gentlemen-indent-your-xml
quite helpful in turning my xml into human-readable structures. It works
best for XML-Data.
Josh
It's done in one line with
http://docs.python.org/library/xml.dom.minidom.html#xml.dom.mini
Westley Martínez wrote:
On Fri, 2011-02-04 at 13:08 -0800, Wanderer wrote:
I want to give the option of changing attributes in a method or using
the current values of the attributes as the default.
class MyClass():
""" my Class
"""
def __init__(self):
""" initialize
Wanderer wrote:
I have a bunch of cameras I want to run tests on. They each have
different drivers and interfaces. What I want to do is create python
wrappers so that they all have a common interface and can be called by
the same python test bench program. I'm not sure what to call it. I
don't th
Dwayne Blind wrote:
Thanks to all of you.
@ Jean-Michel Pichavant
I am writing a small multiplayer game. Several clients are connected
to the server. Games last, say, 20 seconds.
You can think of the game as a small chat lasting 20 seconds. All the
data received by the server is sent back to
Stephen Hansen wrote:
On 2/3/11 9:56 AM, Dwayne Blind wrote:
However I would like to set timeout on the socket rcv method, so that
the while loop stops exactly after 3 seconds. Is this possible ?
I rarely do low-level socket stuff -- [snip]
Good point. Python has a module for almos
Gerald Britton wrote:
Nope. it's nothing to do with imports. It's about objects passed to
methods at run time. Complicated objects with many levels. Not about
modules at all.
Who is providing these objects ?
- Your code ? => as said before, you can fix your design with a proper
object
Gerald Britton wrote:
however, considering what
"import a.module.that.is.quite.nested as myModule"
Won't work since I get the objects at run time
myModule = __import__('whatever.module.imported.at.run.time', globals(),
locals(), [], -1)
See http://docs.python.org/library/function
rantingrick wrote:
On Feb 1, 6:53 am, Adam Tauno Williams wrote:
If you despise IDLE so much - use one of the many other IDE's that
support Python; move on.
Not exactly. Can we continue to ignore such lackluster and shabby code
in OUR stdlib. Remember the code reflects on all of us!
Patty wrote:
pa...@cruzio.com wrote:
I have been avoiding understanding this 'self',
[snip]
Regards,
Patty
What is to be understood ?? self references the instance. Did I miss
something ?
JM
Yes, there was more. And it's been fully explained at this point.
Patty
Hmm... I re-
pa...@cruzio.com wrote:
I have been avoiding understanding this 'self',
[snip]
Regards,
Patty
What is to be understood ?? self references the instance. Did I miss
something ?
JM
--
http://mail.python.org/mailman/listinfo/python-list
sl33k_ wrote:
Hi,
I am struggling to grasp this concept about def foo(*args). Also, what
is def bar(*args, *kwargs)?
Isnt it like self must be the first parameter to the method/function?
If not what are the exceptions?
Also, can the terms method and function be used interchangeably?
TIA
"
Gerald Britton wrote:
Hi all,
Today I was thinking about a problem I often encounter.
[snip]
1. You need to call this thing many times with different arguments, so
you wind up with:
x = some.deeply.nested.object.method(some.other.deeply.nested.object.value1)
y = some.deeply.nested.obj
santosh hs wrote:
I am very new to object oriented concept, so I need to learn
everything frm basic, Will the above books fulfill
My need
read this
http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm
and stop when they start to talk about VBscript :)
JM
--
http://mail.python.org/m
sl33k_ wrote:
What are wrappers?
What entities do they wrap around?
Struggling to understand the concept.
We would need a little bit of a context to answer that question, you
could be refering to differents things.
I'll give it a try on one common usage for wrapper:
A wrapper is a pytho
JB wrote:
One of my python scripts that takes a bunch of inputs from a tKinter
gui, generates a set of command line stings, and then threads them off
to subprocess for calls to other programs like Nuke and our render
farm has recently started randomly crashing pythonw.exe.
I'm taking a look at m
Alan wrote:
I have a class ``A`` that is intentionally incomplete:
it has methods that refer to class variables that do not exist.
The class ``A`` has several complicated methods, a number
of which reference the "missing" class variables.
Obviously, I do not directly use ``A``.
I have a class fa
Jack Bates wrote:
Am struggling to understand Python method-to-instance binding
Anyone know why this example throws a TypeError?
#!/usr/bin/env python
import functools
# Take a generator function (i.e. a callable which returns a generator) and
# return a callable which calls .send()
class
sl33k_ wrote:
How to read syntax like this given in the documentation of python?
(Newbie)
defparameter ::= parameter ["=" expression]
http://docs.python.org/reference/compound_stmts.html#function-definitions
Just in case you're about to learn python using these defintions:
Nobody's lea
santosh hs wrote:
Hi All,
i am beginner to python please tell me which is the best available
reference for beginner to start from novice
Hi,
You could have searched the archive, this question was raised many times.
http://wiki.python.org/moin/IntroductoryBooks
I read "Learning Python" whe
Physics Python wrote:
Hello,
I am teaching myself python using the book: Python Programming for Absolute
Beginners, 2nd edition by Michael Dawson. I am using python 2.7.1.
In chapter 3 we are learning to use structures (while, if, elif) to write a
program that has the user guess a number betw
Michele Simionato wrote:
On Jan 11, 4:06 pm, Alice Bevan–McGregor wrote:
Plac appears (from the documentation) to be written on top of argparse.
:(
And the problem with that being what?
... not available to python 2.5 / 2.6 users :)
JM
--
http://mail.python.org/mailman/listinfo/
dubux wrote:
I am trying to import modules dynamicly from a directory (modules/) in
which i have __init__.py with the __all__ variable set. Everything
imports correctly and I have verified this however I am stuck on
actually using my classes in the dynamicly imported modules.
this bit is in my m
Roy Smith wrote:
[snip]
It's reasonably straight-forward to figure out that absolute path,
starting from sys.argv[0] and using the tools in os.path. Now I need to
import the file, given that I know its absolute pathname. It looks like
imp.load_source() does what I want, I'm just wondering if
kost BebiX wrote:
Sorry for top posting, didn't know about that) I'm quote new to posting to
mailing lists.
Well, actually the code you showed doesn't work)
class A(object):
.. def __init__(self):
.. self.d = {}
.. def __getattr__(self, key):
.. try:
..
kost BebiX wrote:
You're absolutely right! Now try to do except Keyerror: raise AttributeError
and it will also fail. But why?
07.01.2011, 15:45, "Jean-Michel Pichavant" :
kost BebiX wrote:
Hi everyone!
I just saw a bug (?) in bson.dbref:DBRef.__getattr__
Here
kost BebiX wrote:
Hi everyone!
I just saw a bug (?) in bson.dbref:DBRef.__getattr__
Here's they're code:
def __getattr__(self, key):
return self.__kwargs[key]
And when you do copy.deepcopy on that object it will raise you KeyError. So
here's a small piece of code that reproduces th
David wrote:
Hi,
I'd like to have a function that takes arbitrary inputs and returns
them as a single string, with proper escapes for special characters I
can define. For example:
fun( ( + 1 2 ) )
=> "( + 1 2)"
or
fun( (define (myhello str) (begin (print (string-append "Hello "
str)) (newli
Inyeol wrote:
For example: I'm writing simple class:
class Numbers:
def __init__(self, numbers):
self._numbers = numbers
def get_all(self):
for number in self._numbers:
yield number
If I want to add another method for yielding even num
Rob Richardson wrote:
-Original Message-
What about,
def myMethod():
for condition, exitCode in [
(cond1, 'error1'),
(cond2, 'very bad error'),
]:
if not condition:
break
else:
do_some_usefull_stuff() # executed only if the
John Gordon wrote:
(This is mostly a style question, and perhaps one that has already been
discussed elsewhere. If so, a pointer to that discussion will be
appreciated!)
When I started learning Python, I wrote a lot of methods that looked like
this:
def myMethod(self, arg1, arg2):
if s
Mel wrote:
Jean-Michel Pichavant wrote:
Fellows,
I'd like to illutrate the fact that comparing strings using identity is,
most of the time, a bad idea. However I'm searching a short example of
code that yields 2 differents object for the same string content.
id('foo')
bruno.desthuilli...@gmail.com wrote:
On 16 déc, 12:55, Jean-Michel Pichavant
wrote:
id('foo')
3082385472L
id('foo')
3082385472L
Anyone has that kind of code ?
2 points:
1- an id is only valid for the lifetime of a given object - when the
object has been coll
Jean-Michel Pichavant wrote:
Fellows,
I'd like to illutrate the fact that comparing strings using identity
is, most of the time, a bad idea. However I'm searching a short
example of code that yields 2 differents object for the same string
content.
id('foo')
Fellows,
I'd like to illutrate the fact that comparing strings using identity is,
most of the time, a bad idea. However I'm searching a short example of
code that yields 2 differents object for the same string content.
id('foo')
3082385472L
id('foo')
3082385472L
Anyone has that kind of code
Paul Rubin wrote:
Steven D'Aprano writes:
I'm actually quite fond of the look of "while 1:", and sometimes use it,
not because it's faster, but just because I like it.
for v in itertools.repeat(True):
...
;-)
while '__For_ever___' not in ['nit-picking']:
:)
JM
--
http
ernest wrote:
Hi,
I'd like to have a reference to an instance attribute as
default argument in a method. It doesn't work because
"self" is not defined at the time the method signature is
evaluated. For example:
class C(object):
def __init__(self):
self.foo = 5
def m(self, val=se
Octavian Rasnita wrote:
From: "Steven D'Aprano"
...
Can you please tell me how to write the following program in Python?
my $n = 1;
{
my $n = 2;
print "$n\n";
}
print "$n\n";
If this program if ran in Perl, it prints:
2
1
Lots of ways. Here's one:
n = 1
class Scope:
n
Vinay Sajip wrote:
On Dec 10, 10:17 am, Jean-Michel Pichavant
wrote:
Hi Jean-Michel,
I think Antoine answered your other points, so I'll address the last
one:
Last question, if no handler is found, why not simply drop the log
event, doing nothing ? It sounds pretty reasonable and
cassiope wrote:
Alternatively, you can write
import copy
a = [1,2,3]
b = a.copy()
JM
I'm not a pyguru, but... you didn't use copy quite right.
Try instead: b= copy.copy(a)
You're right, you're not a python guru so don't even try to contradict
me ever again.
...
:D of course I di
Dirk Nachbar wrote:
I want to take a copy of a list a
b=a
and then do things with b which don't affect a.
How can I do this?
Dirk
In [1]: a = [1,2,3]
In [2]: b = a[:]
In [3]: b[0] = 5
In [4]: a
Out[4]: [1, 2, 3]
In [5]: b
Out[5]: [5, 2, 3]
Alternatively, you can write
import copy
a
Octavian Rasnita wrote:
It is true that Python doesn't use scope limitations for variables?
Octavian
Python does have scope. The problem is not the lack of scope, to
problem is the shadow declaration of some python construct in the
current scope.
print x # raise NameError
[x for x in ra
mark jason wrote:
On Dec 10, 11:55 am, Steven D'Aprano wrote:
# By the way, IOError is not the only exception you could see.
thanks for the help Steven. Is it OK to catch Exception instead of
IOError ?
In some operation which can cause many errors ,can I use the
following?
try:
Vinay Sajip wrote:
Some changes are being proposed to how logging works in default
configurations.
Briefly - when a logging event occurs which needs to be output to some
log, the behaviour of the logging package when no explicit logging
configuration is provided will change, most likely to log t
Astan Chee wrote:
Hi,
I've got a python script that calls a function many times with various
arguments and returns a result. What I'm trying to do is run this
function each on different processors and compile the result at the
end based on the function result. The script looks something like
this
quoting eclipse page:
"Pydev [...] uses advanced type inference techniques to provide features
such code completion and code analysis"
I don't know exactly what's hidden behind this marketing stuff. Did you
try to document your method with a markup language supported by Eclipse
(if there is an
gst wrote:
greg.
nb: so this "hack" is only relevant during dev ; once the project
would be finished the "hack" could be removed (i.e : in class2 init I
would directly do : self.object1 = object1)
Expect some bugs then on the 'release' version.
I'm not sure I understood everything you menti
Rustom Mody wrote:
If I have a medium to large python code base to browse/study, what are
the class browsers available?
vim + ctags is one of them.
JM
--
http://mail.python.org/mailman/listinfo/python-list
RedBaron wrote:
Hi,
I am beginner to python and i am writing a program that does a lot of
things. One of the requirements is that the program shud generate a
log file. I came across python loggging module and found it very
useful. But I have a few problems
Suppose by giving option '-v' along with
Stef Mientki wrote:
On 06-12-2010 12:08, Ben Finney wrote:
Stef Mientki writes:
I would like to know if a class definition has a decorator,
I'm not sure what this question means.
Applying a decorator to a class definition produces a normal class.
Classes don't “have” decorators
Xavier de Gaye wrote:
Pyclewn 1.5 has been released at http://pyclewn.sourceforge.net/
Pyclewn is a python program that allows the use of Vim as a front end
to gdb and pdb.
This release adds support for ``pdb``, the python debugger.
+ A python script may be run under the control of ``pdb``. F
Adam Tauno Williams wrote:
On Fri, 2010-12-03 at 14:44 +0100, Jean-Michel Pichavant wrote:
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and
Jean-Michel Pichavant wrote:
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and constant over the python process lifetime.
JM
sorry guys
"
Jean-Michel Pichavant wrote:
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and constant over the python process lifetime.
JM
erratum
Hello fellows,
I would need a unique internal identifier to an object. Can I use the
object python id ?
class Foo:
def getUniqueIdentifier():
return id(self)
This id needs to be unique and constant over the python process lifetime.
JM
--
http://mail.python.org/mailman/listinfo/pyt
Harishankar wrote:
As I said before, the way exceptions are caught seem to me to be the most
confusing bit. Non-atomic operations always worry me. What if my function
which is wrapped inside a try block has two different statements that
raised the same exception but for different reasons? With
m b wrote:
> >
> > if __name__ == "__main__":
> > main()
What does this mean?
/Mikael
__name__ is an attribute of the module. Usually it is set to the module
name, except when the module is acutally executed as the entry point, in
that case __name__ is set to '__main__'.
foo.py:
print __n
Tim Harig wrote:
On 2010-12-01, goldtech wrote:
Start
Main
Global Var
Subprogram1
Subprogram2
Subprogram3
End of Main
End
module_wide_var = value
def Subprogram1:
# code
def Subprogram2:
# code
def Subprogram3:
# code
def main:
Subpr
Gnarlodious wrote:
On Dec 1, 6:23 am, Jean-Michel Pichavant
wrote:
what about
def query():
return ["Formating only {0} into a string".format(sendList()[0])] +
sendList()[1:]
However this solution calls sendList() twice, which is too processor
intensive.
You got to
Gnarlodious wrote:
This works for me:
def sendList():
return ["item0", "item1"]
def query():
l=sendList()
return ["Formatting only {0} into a string".format(l[0]), l[1]]
query()
However, is there a way to bypass the
l=sendList()
and change one list item in-place? Possibly a lis
401 - 500 of 984 matches
Mail list logo