On Thu, Nov 26, 2009 at 8:04 AM, Gregory Ewing
greg.ew...@canterbury.ac.nzwrote:
n00m wrote:
I can't understand why we can get __name__, but not __dict__,
on the module level?
For much the same reason that you can see your own
feet but (unless you look in a mirror) you can't
see your
On Mon, May 4, 2009 at 3:01 PM, John O'Hagan m...@johnohagan.com wrote:
On Mon, 4 May 2009, Matthias Gallé wrote:
Hi.
My problem is to replace all occurrences of a sublist with a new element.
Example:
Given ['a','c','a','c','c','g','a','c'] I want to replace all
occurrences of
On Mon, Apr 27, 2009 at 11:55 AM, Vsevolod vselo...@gmail.com wrote:
As well I'd like to outline, that, IMO, your answer exhibits the
common attitude among pythonistas: everything should be done in one
true way, which is the best option (and that is how it's implemented
in the current
On Sat, Mar 21, 2009 at 5:22 PM, Stefan Behnel stefan...@behnel.de wrote:
Hi all,
I'm proud to announce the release of lxml 2.2 final.
http://codespeak.net/lxml/
http://pypi.python.org/pypi/lxml/2.2
Changelog:
http://codespeak.net/lxml/changes-2.2.html
Great news! I have relied on lxml
On Wed, Mar 18, 2009 at 11:26 AM, Walther Neuper neu...@ist.tugraz.atwrote:
Hi,
loving Java (oo) as well as SML (fun) I use to practice both of them
separately.
Now, with Python I would like to combine 'oo.extend()' with 'functional
map':
Python 2.4.4 (#2, Oct 22 2008, 19:52:44)
[GCC
On Tue, Feb 3, 2009 at 6:56 PM, Steve Holden st...@holdenweb.com wrote:
Thanks you so much, Christof. The spam filters successfully kept this
URL out of c.l.py until you took the trouble to re-publish it.
regards
Steve
Speaking of which: it seems to me that the amount of spam that I
On Mon, Dec 22, 2008 at 7:01 PM, r rt8...@gmail.com wrote:
Walter,
I just look at the stats for comp.lang.python, and i am 9th place for
most post this month. That makes me completely sad. With just 50 post
so far, i am showing up on the high count. Sad, very sad. Now i have
much reason to
On Mon, Nov 17, 2008 at 6:44 PM, [EMAIL PROTECTED] wrote:
On Nov 17, 8:54 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
Candidate to *Longest and Most Boring Thread of the Year* - started
more than a month ago, currently discussing The official definition
of call-by-value, and
On Wed, Nov 12, 2008 at 2:01 PM, Steve Holden [EMAIL PROTECTED] wrote:
Now, can we get on to something substantive like how many angels can
dance on the head of a pin?
Oh, come on, that's too easy! 42.
I thought that by now everybody knew that.
Francesco
--
On Thu, Oct 2, 2008 at 11:23 AM, [EMAIL PROTECTED] wrote:
nneonneo Hmm, I was looking forward to trying this out, but the Windows
nneonneo installer link
nneonneo (http://www.python.org/ftp/python/2.6/python-2.6.msi) is
nneonneo presently broken (as is the link for the 64-bit
On Thu, Sep 4, 2008 at 3:25 PM, Mathieu Prevot [EMAIL PROTECTED] wrote:
Hi,
for scripts that take arguments, I would like to remove the trailing
slash if it's present.
Is there something else than:
a='/usr/local/lib/'
if a[-1] == '/':
a = list(a)
a.pop()
''.join(a)
Thanks,
On Jan 14, 2008 3:52 PM, Alexandru Dumitrescu
[EMAIL PROTECTED] wrote:
Hi,
I'm new to this list and to python.
I am wondering, am I able to make my program read the *.txt files from a
directory and
to add, at the top of the file, three new lines which are stored in a *.csv
file?
On Jan 11, 2008 6:20 PM, John Nagle [EMAIL PROTECTED] wrote:
Tried:
print item.dir()
got:
'cell' object has no attribute 'dir'
I don't know nothing about cell objects...
but why don't you try dir(item) instead?
Francesco
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 9, 2008 6:35 AM, jimgardener [EMAIL PROTECTED] wrote:
thanx guys for the replies
need a little clarification
srcarray=array([1.2,2.3,3.4,4.5,5.6])
destarray=array(srcarray,copy=False)
then
srcarray[2]=99.9
will cause the change to be reflected in both src and dest.
doesn't that
On Jan 8, 2008 11:17 AM, Jon Harrop [EMAIL PROTECTED] wrote:
Are there any Python magazines that you can pay to subscribe to? (either
paper or on-line).
Python Magazine comes to mind
www.pythonmagazine.com
I am subscribed and find it very good.
Francesco
--
On Jan 8, 2008 4:32 PM, jimgardener [EMAIL PROTECTED] wrote:
hi,
(i posted this to numpy discussion grp couple of days back ..but it
fails to appear..)since it is needed for my work i would appreciate if
anyone can help me with this question
i have two ndarrays of 1000 elements each and
On Jan 5, 2008 11:31 AM, [EMAIL PROTECTED] wrote:
import tok
class code:
def __init__( self, start, stop ):
startLoc = start
stopLoc = stop
class token(code):
pass
Apart from the missing self, remember that the __init__(...) of the
base classes is not
On Jan 4, 2008 11:55 PM, Steven W. Orr [EMAIL PROTECTED] wrote:
class S(int):
def __init__(self, value):
self.value = value
def addStr(self, str):
self.doc = str
The original question has already been answered,
I only want to suggest to avoid shadowing builtin names,
On Dec 3, 2007 4:40 PM, Russ P. [EMAIL PROTECTED] wrote:
As I said before, a name is
just a name. It might as well be called cockroach as far as I am
concerned.
Unluckily the Beatles was already taken :-)
francesco
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 30, 2007 5:57 AM, Astan Chee [EMAIL PROTECTED] wrote:
Hi,
I have a file that might contain literal python variable statements at
every line. For example the file info.dat looks like this:
users = [Bob, Jane]
status = {1:ok,2:users[0]}
the problem is I want to read this file and load
On 10/22/07, james_027 [EMAIL PROTECTED] wrote:
hi,
i have a function that I could like to call, but to make it more
dynamic I am constructing a string first that could equivalent to the
name of the function I wish to call. how could I do that? the string
could might include name of the
On 10/16/07, Beema shafreen [EMAIL PROTECTED] wrote:
hi everybody,
I have a file separated by hash:
as shown below,
file:
A#1
B#2
A#2
A#3
B#3
I need the result like this:
A 1#2#3
B 2#3
how will generate the result like this from the above file
can somebody tell me what i have
On 10/16/07, danfolkes [EMAIL PROTECTED] wrote:
Instead of: if(cal=0)
you could do :
cal=0
while cal=0:
cal = int(raw_input(Please enter the number of calories in your
food: ))
that would make sure that your input is 0
Calories could be non integer :)
francesco
--
On 10/15/07, Steven D'Aprano [EMAIL PROTECTED] wrote:
''.join(reversed(abc))
'cba'
list(reversed(range(3)))
[2, 1, 0]
It doesn't take much to make a more user-friendly version:
def myreversed(sequence):
if isinstance(sequence, basestring):
return
On 10/15/07, Steven D'Aprano [EMAIL PROTECTED] wrote:
On Mon, 15 Oct 2007 14:47:30 +0200, Francesco Guerrieri wrote:
def myreversed(sequence):
if isinstance(sequence, basestring):
return type(sequence)().join(reversed(sequence))
else:
return type(sequence
On 10/11/07, brad [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
On Oct 11, 5:22 pm, brad [EMAIL PROTECTED] wrote:
Crazy question, but has anyone attempted this or seen Python code that
does? For example, if a text file contained 'Guido' and or 'Robert' and
or 'Susan', then we should
Hi,
Today I've been thinking a bit about the python internals. Inspired
by this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062
I found out a little problem which haven't been able to solve.
In short, is there a way to find out how a given name lookup was started?
It is not
On 9/30/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hello everyone,
OK, so I want to split a string c into words using several different
separators from a list (dels).
Have a look at this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303342
which contains several ways
On 9/30/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hello everyone,
OK, so I want to split a string c into words using several different
separators from a list (dels).
Have a look at this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303342
which contains several ways
On 9/28/07, TheFlyingDutchman [EMAIL PROTECTED] wrote:
Correct me if I am wrong, but none of those examples showed something
in C++ similar to a decorator in Python - that is, unique syntax in
the language for implementing a Higher Order Function. One thing I
will say about those examples is
On 9/28/07, TheFlyingDutchman [EMAIL PROTECTED] wrote:
On Sep 28, 10:57 am, Steve Holden [EMAIL PROTECTED] wrote:
This is like listening to a four-year-old torment its parents with
incessant questions. Do you *have* to ask every question that pops into
your mind?
In this case I asked it
On 9/19/07, Paddy [EMAIL PROTECTED] wrote:
frozenset over turning the embedded list into a tuple?
The tuple would preserve order in the item (1,2)
a = set([1,2,3, (1,2)])
The OP was probably thinking in mathematical terms as in the set of
all the possible subsets of the set composed by 1,
On 9/19/07, Raj kumar [EMAIL PROTECTED] wrote:
Hi,
I need help regarding the starting point in python project,
As we can find main() function in java class to know the starting class in
java,
what is the starting point in python project?
How to find the starting point.
Thank you
There is
On 9/19/07, Leon [EMAIL PROTECTED] wrote:
stringID = str(raw_input('Enter the string ID : '))
file = open('strings.txt')
sourcefile = file.read()
file.close()
sourcefile.find (stringID)
but how can I select and copy the specific string from str to /str
with id I input?
If the file you are
On 9/19/07, Carsten Haese [EMAIL PROTECTED] wrote:
, then looking for id 12 is going to match on the wrong ID. Besides,
that code only tells you where something that looks like the ID you're
looking for is in the file. There is no guarantee that the match
actually occurs inside an ID
On 9/18/07, Robert Rawlins - Think Blue
[EMAIL PROTECTED] wrote:
This seems like a very logical method, but I'm not sure how to implement it
into my python code? Is there a simple way to make it wait for that file?
Without the need to build my own conditional loop?
I'm not sure why how you
On 9/18/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
If I have a file name: AVC1030708.14. How do I strip out certain
characters from the file name? I am so used to using MID, LEFT, and
RIGHT functions, that I have no idea how to do this in python? I have
had trouble as well with most
On 9/18/07, Michael Bentley [EMAIL PROTECTED] wrote:
import os.path
import time
while True:
if os.path.exists(YOUR_FILE):
break
time.sleep(30)
or
while not os.path.exists(YOUR_FILE):
time.sleep(1)
I thought of that, but I found more readable the positive
On 9/10/07, bambam [EMAIL PROTECTED] wrote:
I have a number of news readers here, but all of them work
better with top-posting, and in none of them is top posting
a problem. What software are you using?
Steve.
I use gmail and I can assure you that top posting is annoying.
francesco
--
On 9/10/07, Nagarajan [EMAIL PROTECTED] wrote:
Hi group,
I am confused with super usage..It seems to be complicated and less
obvious.
Here is what I need to achieve..
class A :
def __init__( self ):
self.x = 0
class B ( A ):
def __init__( self, something ):
#
On 9/10/07, Nagarajan [EMAIL PROTECTED] wrote:
What's the difference b/w:
class A:
and
class A ( object ):
Thanks.
The first one declares an old-style class. The second one declares a new
style class.
It's better to use the new-style (always derive from object).
See
On 9/5/07, bambam [EMAIL PROTECTED] wrote:
I have about 30 pages (10 * 3 pages each) of code like this
(following). Can anyone suggest a more compact way to
code the exception handling? If there is an exception, I need
to continue the loop, and continue the list.
Steve.
On 9/5/07, planetmatt [EMAIL PROTECTED] wrote:
I am a Python beginner. I am trying to loop through a CSV file which
I can do. What I want to change though is for the loop to start at
row 2 in the file thus excluding column headers.
At present I am using this statement to initiate a loop
On 9/5/07, dkeeney [EMAIL PROTECTED] wrote:
The Python community would benefit from a moderated web-forum along
the lines of
perlmonks.org.
The Python community online now seems to have two major segments, the
c.l.p newsgroup (here),
and a large selection of blogs. C.l.p is unmoderated
On 9/5/07, James Stroud [EMAIL PROTECTED] wrote:
Another way is to make a copy of devs, if devs is short, which makes my
When I process something of that genre (e.g. files) I prefer not to lose
trace of what's happened by removing the bad items. Instead I prefer to
flag or otherwise to
On 9/3/07, Wildemar Wildenburger [EMAIL PROTECTED] wrote:
Grzegorz Słodkowicz wrote:
In fact, a proper vector in physics has 4 features: point of
application, magnitude, direction and sense.
OK, help me out here: What 'direction' does |Ψ (a state-vector in
quantum mechanics) have? Also,
On 9/2/07, Zentrader [EMAIL PROTECTED] wrote:
On Aug 30, 11:23 am, [EMAIL PROTECTED] wrote:
Neil, Steve,
Thanks for the responses on sets. I have not used them before and was
not even aware Python had them. I will try them out.
And if there weren't sets you would still not use find or
On 8/31/07, Gerardo Herzig [EMAIL PROTECTED] wrote:
Well, im not triyng to send a SMS `FROM' a cellphone, im trying to send
a SMS `TO' a cellphone. Here (in Argentina) are several sites who lets
you send a sms for free. You also can receive SMS responses via this page
On 8/27/07, Peter Otten [EMAIL PROTECTED] wrote:
Peter Otten wrote:
Alex Martelli wrote:
Integer objects that are once generated are kept around in a free list
against the probability that they might be needed again in the future (a
Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
On 8/28/07, Nagarajan [EMAIL PROTECTED] wrote:
A simple yaml file might just do the trick.
Your yaml file shall look like the following:
Word-def.yaml
word1: word1's definition
word2: word2's definition
..
..
..
Use pyyaml to handle yaml files.
import yaml
worddefs =
On 8/23/07, dimitri pater [EMAIL PROTECTED] wrote:
Dear all,
I am having trouble joining elements in a list into 1 element.
e.g. ['a','b','c'] into ['abc'] so that len(list) returns 1
You need to append the joined string to your new list.
For instance
my_list = [a, b, c]
my_second_list = []
On 8/23/07, J. Cliff Dyer [EMAIL PROTECTED] wrote:
What do you want to have happen in this case?
my_list = [ 'a', 4, 'c' ]
It depends on the requirements of the OP.
A possible solution could be:
my_second_list = []
try:
my_second_list.append(.join(my_list))
except TypeError:
On 8/15/07, mfglinux [EMAIL PROTECTED] wrote:
#Let's say x=3, then Period definition is
Period=Slab(Material1(12.5)+Material2(25)+Material3(12.5)) #Slab is a
python class
I dont know how to automatize last piece of code for any x
Hello,
you could use exec to create on the fly the
On 6/14/07, Peter Otten [EMAIL PROTECTED] wrote:
Gabriel Genellina wrote:
...
py print timeit.Timer(f2(), from __main__ import f2).repeat(number=1)
[0.42673663831576358, 0.42807591467630662, 0.44401481193838876]
py print timeit.Timer(f1(), from __main__ import f1).repeat(number=1)
Within gnuplot you can shorten with to w, don't know if it can
work inside a call to Gnuplot.Data()
francesco
On 6/11/07, BBands [EMAIL PROTECTED] wrote:
I gather that 'with' is on its way to becoming a reserved word. Is
this something that will break?
import Gnuplot
gp =
If the functions are
f1, f2, f3 you could go this way:
def SimulationRun():
if simulation_level = 1: SimulationFunction = f1
else if simulation_level = 2: SimulationFunction = f2
else
and in the rest of the code you can refer to SimulationFunction
instead of explicitly calling
Hello,
this is my first post to the list :-) I've looked around a bit before
asking, and since I haven't found... I'm here to ask my question.
I'm trying to ovveride attribute setting, but I haven't still found
the right way to use all the fancy __get__, __set__ and
__getattribute__ :-)
I would
On 6/6/07, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED], Francesco
Guerrieri wrote:
Now the question is this:
I would like to initialize such an object in this way:
a = myList()
a = [[1, 2, 3], [4, 5, 6, 7]]
a.pad()
# and now a _should_ contain [[1, 2, 3
58 matches
Mail list logo