So either way, *something* is returned, and in the case of the recursive call,
the innermost result is returned back up through all levels of the recursion.
Is that what you wanted?
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
here to obscure things. Try this:
Here b is a list that contains three references to a. Modify a, and
all three references to a show the modification:
a = [1,2,3]
b = [a,a,a]
a.append(4)
b
[[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]
Gary Herron
nn=3*[[]]
nn
. (And then the problem will
most likely be in your expectations, not in the find method.)
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
]
or
... probably other ways can be found ...
but what's wrong with you original code?
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
New submission from Gary VanHorn [EMAIL PROTECTED]:
Where can an error code resource be found?
--
components: Installation
messages: 75744
nosy: sharksuit
severity: normal
status: open
title: 3.0rc2.msi Install Fails (Error Code 2755)
versions: Python 3.0
unexpected, and
definitely undesirable.
I don't believe it -- send your *actual* code, and we'll all have a look.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org
this:
import re
re.sub('[0-9]', '',
ttccatttctggacatgacgtctgt6901ggtttaagctttgtgaaagaatgtgctttgattcg)
'ttccatttctggacatgacgtctgtggtttaagctttgtgaaagaatgtgctttgattcg'
Gary Herron
--
Beema Shafreen
--
http
worth a test.
If you run timing test, let us know the results.
Gary Herron
I implemented this the following way:
def get_highest_bit_num(r):
i = -1
while r 0:
r = 1
i = i + 1
return i
This works, but it is a very unsatisfying solution, because it is so
/listinfo/python-list
Is sys.argv[0] what you want? If so, then os.path.basename(sys.argv[0])
is probably what you want.
Thanks,
Gary M. Josack
--
http://mail.python.org/mailman/listinfo/python-list
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
you've got ?self.send_header('Server', self.version_string()) in the
send_response method of the BaseHTTPRequestHandler class in the
BaseHTTPServer module. Long story, short, it's going to be a lot of work
to get rid of.
[EMAIL PROTECTED] wrote:
Hello.
I'm using SimpleHTTPServer (work
// Or some such
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Gary Herron wrote:
process wrote:
Let's say I have a class X which has 10 methods.
I want class Y to inherit 5 of them.
Can I do that? Can I do something along the lines of super(Y, exclude
method 3 4 7 9 10) ?
--
http://mail.python.org/mailman/listinfo/python-list
sc wrote:
clp:
Thanx to a recent thread I am able to have a print string
with a variable number of formatters -- what I now lack for
the creation of an elegant print statement is a tuple --
following is the code, the last line of which does not work:
code
#!/usr/bin/python
import xml.sax
Googling for them,
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
William Purcell wrote:
I want to use eval to evaluate wx.TextCtrl inputs. How can I keep
python from adding the __builtins__ key to mydict when I use it with
eval? Other wise I have to __delitem__('__builtins__') everytime I use
eval?
mydict = {'a':2,'b':3}
eval('a*b',mydict)
6
mydict
Chris Rebert wrote:
On Sun, Sep 28, 2008 at 12:59 PM, sotirac [EMAIL PROTECTED] wrote:
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
pre
random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) #
Aaron Castironpi Brady wrote:
On Sep 28, 2:59 pm, sotirac [EMAIL PROTECTED] wrote:
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
pre
random_number = random.sample([0,1,2,3,4,5,6,7,8,9], 5) # choose 5
Gary M. Josack wrote:
Aaron Castironpi Brady wrote:
On Sep 28, 2:59 pm, sotirac [EMAIL PROTECTED] wrote:
Wondering if there is a better way to generate string of numbers with
a length of 5 which also can have a 0 in the front of the number.
pre
random_number = random.sample
* it is you want!
Gary Herron
On 9/23/08, *Gary Herron* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
A. Joseph wrote:
I need an ebook or tutorial that teach matrix programming.
Perhaps you should start here:
http://www.catb.org/~esr/faqs/smart-questions.html#intro
A. Joseph wrote:
I need an ebook or tutorial that teach matrix programming.
Perhaps you should start here:
http://www.catb.org/~esr/faqs/smart-questions.html#intro
Gary Herron
--
http://mail.python.org/mailman
process wrote:
In erlang you can cons like this: [1|2]. i tried this in python and it
didnt raise an error but i dont know what the result do
In Python | is the logical bitwise-OR operator. Look at the binary
representation of the numbers to understand it.
Gary Herron
[1|2
whatever
i -= 1
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
to register and start a service, and how to stop and remove it
later. Google finds lots of information on this -- perhaps I'll post my
result when I've pulled it all together.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
answer as to what happens in
python?
Thanks
No code is duplicated. 50 objects are created. Each object has its own
copy of the data attributes, and a reference to the (one and only) class
object where the method attributes are located.
That's a short answer. Perhaps too short?
Gary Herron
Changes by Gary Poster [EMAIL PROTECTED]:
--
nosy: +gary
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3829
___
___
Python-bugs-list mailing list
to write a DLL in C/C++ that calls the function first?
Thanks!
Siegfried
See the ctypes module for a method of calling any C callable function in
and DLL.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
srinivasan srinivas wrote:
I want to do something like below:
1. first, second, third, *rest = foo
Python 3.0 has exactly this feature. No current Python 2.x version has it.
Gary Herron
2. for (a,b,c,*rest) in list_of_lists:
Please suggest.
Thanks,
Srini
Bring your gang
this helps,
Gary Herro
--
http://mail.python.org/mailman/listinfo/python-list
reason
to use sys.exit() given exit()'s availability?
If there is an advantage to sys.exit() over exit(), then does sys.exit() have
any advantage over raise SystemExit, 'some error message' in cases where a
module has no other reason to import sys?
--
Gary Robinson
CTO
Emergent Music, LLC
.
Hoping I understood what you wanted correctly,
Gary Herron
... but obviously, the Client class, when it calls the callback,
doesn't pass a reference to the self object. How do I do this?
-- Chris
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman
cnb wrote:
if i do
try:
something
except TypeError, IndexError:
pass
only the first error will get caught. I dont want to use Exception and
catch all errors, but just 2. how can i do that?
--
http://mail.python.org/mailman/listinfo/python-list
what you're doing is assigning the
aditya shukla wrote:
Hello guys
I am trying to search a file say xyz.txt
after searching i get the location of the file in
search_file (containing abspath) ,eg search_file=c:\\abc\\xyz.txt
now how should i open this file
i can use file=open(c:\\abc\\xyz.txt,rb) but i have to use search_
...
IDs = set(extractIdFromRow(row) for row in rowsOfTable)
or some such would be most efficient.
Gary Herron
Heres the code:
import string
def checkForProduct(product_id, product_list):
for product in product_list:
if product == product_id:
return 1
return 0
chunks (efficiently) and then serves up the contents
line-by-line.
Gary Herron
If you use a dictionary and search the ID's there, you'll notice some
speed improvements as Python does a dictionary lookup far quicker than
searching a list. Then, output your data all at once at the end
, so you get a
zero. Should you be asking for a string value? (That's the way
OpenOffice/python works if I remember correctly.)
Or are you accessing a different cell because you've confused 0-based /
1-based indexing?
Or are you using old outdated versions of xlrd, Python or Excel?
Gary
a program???)
My impression was (and still is):
A page of Python code looks *clean*, with not a lot of
punctuation/special symbols and (in particular) no useless lines
containing {/} or begin/end or do/done (or whatever).
Gary Herron
Thanks
--
http://mail.python.org/mailman/listinfo/python
to),
...
]
ftpCommands = {}
for cmd,args in cmd_data.iteritems():
ftpCommands[cmd] = CommandProperty(*args)
Gary Herron
IMHO this is a little easier to manage because you can take
advantage of the default values for keyword arguments to eliminate
some of the arguments.
Hope this helps,
Larry
--
http
state external to the program (file content, socket data, phase
of the moon, price of tea in China, ...)
Each of those possibilities would require a substantially different
approach.
Gary Herron
I might be approaching this from the wrong direction entirely. Thanks
for your input.
--
http
Diez B. Roggisch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Gary schrieb:
Diez B. Roggisch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
You can't make any TCP/IP communication run through a proxy, unless it's
transparent.
Thanks for all the info.
I'm puzzled
, it is referred to many times.
a = HeavyObject()
b = a
A = [a,b]
B = [b,a]
C = set([a,b])
D = {1:a, 2:b}
... and do on
Implementation wise, a long list consumes about 4 bytes per list element
(that's one address per), plus a tine amount of overhead.
Gary Herron
I know there is a thing called
)
# etc., etc.
I tested this (just barely), and it seems to work as you wish.
Gary Herron
TIA!
Kynn
--
http://mail.python.org/mailman/listinfo/python-list
, and even their values, before calling __sign_auth(...).
Gary Herron
Tim Henderson
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
I've seen examples for HTTP and FTP use, but not for simply any TCP data on
any port, which is what I require. Can anyone please point me in the right
direction?
TIA
--
http://mail.python.org/mailman/listinfo/python-list
this list without the newline characters
being added. or somehow remove the newline characters. Any help would
be appreciated.
The problem has nothing to do with lists. The readlines() function
returns each line *with* its newline.
To strip it off, use line.strip()
Gary Herron
Diez B. Roggisch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Gary wrote:
For what?
A non-transparent proxy, for anonymity purposes only.
--
http://mail.python.org/mailman/listinfo/python-list
Guilherme Polo wrote:
On Mon, Jul 28, 2008 at 6:24 PM, Ervan Ensis [EMAIL PROTECTED] wrote:
My programming skills are pretty rusty and I'm just learning Python so this
problem is giving me trouble.
I have a list like [108, 58, 68]. I want to return the sorted indices of
these items in the
?
Gary Herron
Cheers,
Kim
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
Trent Mick wrote:
Manuel Vazquez Acosta wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Just test for maxint value:
from sys import maxint
if maxint 33:
print more than 32 bits # probably 64
else:
print 32 bits
I believe that was already suggested in this thread. That test
Gary Herron wrote:
Support Desk wrote:
Hello all,
I am using os.popen to get a list returned of vpopmail
users, something like this
x = os.popen('/home/vpopmail/bin/vuserinfo -n -D
mydomain.com).readlines()
x returns a list, of usernames, and I am trying to append
it.Second, if I exend your string with one more line
foo(123) to actually execute the code, it still works as expected.
So let's try this again... and this time please please also show us the
full text of the error message.
Gary Herron
and i run it using exec(code) in python, math is not known
it.Second, if I extended your string with one more line
foo(123) to actually execute the code, it still works as expected.
So let's try this again... and this time please please also show us the
full text of the error message.
Gary Herron
and i run it using exec(code) in python, math
to False then you can use just this:
C and A or B
Gary Herron
And while I'm on my high horse, I'd like to bring up list concatenations. I
recently needed to concatenate 5 lists, which doesn't sound a particularly
rare requirement to me. My first attempt was a straightforward loop
extending
]
sum([A,B,C], [])
[1, 2, 3, 4, 5, 6, 7, 8, 9]
It doesn't get any easier than that.
Gary Herron
DaveM
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
be
representable exactly.
However, as with any floating point calculations, if you expect exact
representation or calculations with any numbers, then you are misusing
floating points.
Gary Herron
I would think this is a common need, but I cannot find a function in
the Python library to do
)
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
://mail.python.org/mailman/listinfo/python-list
sys.path is a list that will tell you where python is looking. You can
append to this in your scripts to have python look in a specific
directory for your own modules.
Thanks,
Gary M. Josack
--
http://mail.python.org/mailman/listinfo/python-list
Brett Ritter wrote:
On Jul 26, 2:57 pm, Gary Josack [EMAIL PROTECTED] wrote:
sys.path is a list that will tell you where python is looking. You can
append to this in your scripts to have python look in a specific
directory for your own modules.
I can, but that is almost certainly
Cameron Simpson wrote:
On 25Jul2008 11:34, Johny [EMAIL PROTECTED] wrote:
| Is there a way how to find out running processes?E.g. how many
| Appache's processes are running?
See the popen function and use the ps system command.
Use of the popen functions is generally discouraged since being
.
What method *did* you use to print?
If you just typed the variable into which you had read the contents,
then you get the equivalent of
print repr(c)
which explains the escapes.
Try
print c
and that won't happen.
Gary Herron
ie my output should be
d|fj|dnv|jd|0.33|c:\\windows\\win32
and go to n-1(where n-len(s))
(it does not mean start at zero and go to -1)
So since the indexing is counting upward, the step size had better be
positive. Thus:
s = '123456789'
s[:-1:2]
'1357'
Gary Herron
''
though I expected something like '8642'
What did i missed?
--
http
Samir wrote:
On Jul 21, 3:20 pm, Gary Herron [EMAIL PROTECTED] wrote:
Samir wrote:
Hi Everyone,
I am relatively new to Python so please forgive me for what seems like
a basic question.
Assume that I have a list, a, composed of nested lists with string
representations
active new groups.)
Pygame: http://www.pygame.org/news.html
Pyglet: http://pyglet.org/
Gary Herron
~Michael
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
tuple of arguments
to the correct length so you can do:
a,c,b = fix(1,2)
d,e,f = fix(1,2,3,4)
However, the function won't know the length of the left hand side
sequence, so it will have to be passed in as an extra parameter or hard
coded.
Gary Herron
--
http://mail.python.org/mailman
with the for loop's
indexing through the list, causing the loop to mis the element following
the deleted item.
Gary Herron
I am not sure if this question even makes any sense anymore. I've been
using python for years and never had any problems (and I don't now
either) but now that I had
McA wrote:
On 17 Jul., 18:33, Gary Herron [EMAIL PROTECTED] wrote:
In Python 2.x, you can't do that directly, but you should be able to
create a function that lengthens or shortens an input tuple of arguments
to the correct length so you can do:
a,c,b = fix(1,2)
d,e,f = fix(1,2,3,4
Ratko wrote:
On Jul 17, 9:57 am, mk [EMAIL PROTECTED] wrote:
Gary Herron wrote:
You could remove the object from the list with
del myList[i]
if you knew i. HOWEVER, don't do that while looping through the list!
Changing a list's length will interact badly with the for loop's
indexing
shells will provide similar functionality using a variety
of similar syntaxes: , , , and |, and so on.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
might be your definition
of) a word, and in particular will match abc in :abc:. Regular
expressions have lots of other special \-sequences that might be worth
your while to read about: http://docs.python.org/lib/re-syntax.html
Gary Herron
--
http://mail.python.org/mailman/listinfo/python
-in-python
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
of module ABC has not
progressed to the point that abc is defined.
The solution: Just
import ABC
and later reference ABC.abc
That being said, it is still a good design practice to structure your
modules hierarchically rather than a circularly.
Gary Herron
--
http://mail.python.org/mailman
exactly one day ago:
from datetime import *
datetime.today()
datetime.datetime(2008, 7, 10, 13, 38, 48, 279539)
datetime.today()-timedelta(1)
datetime.datetime(2008, 7, 9, 13, 38, 50, 939580)
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
RV wrote:
On Thu, 10 Jul 2008 13:39:29 -0700, Gary Herron
[EMAIL PROTECTED] wrote:
The datetime module has what you need.
It has methods (with examples) on building a datetime object from a
string, and it has a object named timedelta, and the ability to subtract
a timedelta from a time
assigned into it:
codecs = ...something overwriting the module object ...
Gary Herron
I wonder if I need to do something before using the codecs library
from within the cgi module?!
Thank you very much for your help,
Nora
looking carefully
throughout the code.
Gary Herron
Thank you,
Robert
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
differences (mutability, sorting and other
methods, types of individual elements), I'd say there are more
differences than similarities, even though, as sequences, they both
support a small subset of similar operations.
Gary Herron
David C. Ullrich wrote:
Luckily I tried it before saying
for it.
Good luck.
Gary Duzan
Motorola HNM
--
http://mail.python.org/mailman/listinfo/python-list
chamalulu wrote:
On Jul 1, 11:24 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote:
chamalulu schrieb:
Hello.
I think I'm aware of how attribute access is resolved in python. When
referencing a class instance attribute which is not defined in the
scope of the instance, Python looks for a
chamalulu wrote:
On Jul 2, 1:17 am, Gary Herron [EMAIL PROTECTED] wrote:
No need. Also, you can define a class attribute (C++ might call it a
static attribute) and access it transparently through an instance.
class C:
aClassAttribute = 123
def __init__(self, ...):
...
c = C
/mailman/listinfo/python-list
Pyglet is my favorite: http://www.pyglet.org/
Twisted might be fine for the online multiplayer parts, but really if
you want a 2D/3D real-time game, start with a game framework.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
: *never* use is.
(A longer answer can find some uses cases for is, but stick with the
short answer for now.)
Gary Herron
Python 2.5.2
'string' is 'string' #simple assignment works
True
s = 'string'
s is 'string'
True
def make_string(): return 'test
thing: Find out what value that index has, then if it's necessary
to ask your question again, include that information and we'll have
something to go on in forming an answer.
Gary Herron
I have this error message:
IndexError: each subindex must be either a slice, an integer,
Ellipsis
Gary Herron
The only problem is if I leave a comment only in the except block, I
get an error back saying that the except block is not properly
formatted, since it has no content other than a comment.
So if anyone could suggest some code to put there as a placeholder
that would be wonderful
and the standard module named imp.
Gary Herron
*
*
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
python-list. Like this:
class ParentClass(object):
... def __init__(self, keyword1, keyword2):
... print 'ParentClass.__init__ called with', keyword1, keyword2
...
class ChildClass(ParentClass):
... pass
...
child = ChildClass(123,456)
ParentClass.__init__ called with 123 456
Gary
limit wrong? I guess so! But I'm pretty sure I saw it max out at 2GB on linux...
Anybody have an explanation, or is it just that my understanding of a 2GB limit
was wrong? Or was it perhaps right for earlier versions, or on linux...??
Thanks for any thoughts,
Gary
--
Gary Robinson
CTO
Emergent
Serve Lau wrote:
What is the expected result of -1/2 in python?
--
http://mail.python.org/mailman/listinfo/python-list
From the manual:
The result is always rounded towards minus infinity: 1/2 is 0, (-1)/2 is
-1, 1/(-2) is -1, and (-1)/(-2) is 0.
Gary Herron
--
http://mail.python.org
Christian Heimes wrote:
Serve Lau wrote:
What is the expected result of -1/2 in python?
0
No. That's not right. (It would be in C/C++ and many other languages.)
See my other response for the correct answer.
Gary Herron
Christian
--
http://mail.python.org/mailman
is
a trade off (like any caching scheme) of cache-space versus efficiency
gains. The value has changed at least once in recent versions of Python.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
.
self.SomeField = params[mykey] if params.has_key(mykey) else None
Gary Herron
Obviously I know this is not actual Python syntax, but what would be
the equivalent? I'm trying to avoid this, basically:
if params.has_key(mykey):
self.SomeField = params[mykey]
else
of this is a stupid question)
Not stupid. It will all start making sense soon.
Gary Herron
Dan
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
?
No.
Conclusion: Don't use reload (ever). A dozen years of Python
programming, and I've never used it even once. If there is a
good use case for reload, you are probably years from being there.
Gary, thanks very much for your help.I suspected it was something
like this. I still can quite
function that does what you
want.
import re
r =',|;' # or this also works: '[,;]'
s = a,b;c
re.split(r,s)
['a', 'b', 'c']
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
) or so.
Happy google-ing and good luck.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
AttributeError:
pass
or:
try:
del obj.foo
except AttributeError:
pass
or:
if hasattr(obj, 'foo')
delattr(obj, 'foo')
For backwards compatibility, allow_missing would default to False.
Gary
--
http://mail.python.org/mailman/listinfo/python-list
of information
about a method (even including the file name and line number where it
was defined). Poke around and perhaps you can find exactly what you are
looking for.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Rainy wrote:
I have a stylistic question. In most languages words in var. name are
separated by underscores or cap letters, resulting in var names like
var_name, VarName and varName. I don't like that very much because all
3 ways of naming look bad and/or hard to type. From what I understand,
Karlo Lozovina wrote:
This is what I'm trying to do (create a list using list comprehesion, then
insert new element at the beginning of that list):
result = [someFunction(i) for i in some_list].insert(0, 'something')
But instead of expected results, I get None as `result`. If instead of
to enable it?
Thanks!
Try again. I think you'll find it's still there -- although you have to
execute a something that returns a value before it's set for the first time.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
all the imported modules, but I suspect you'll find that it's much
easier to let py2app and py2exe determine what's imported than it is to
go through sys.modules yourself.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
501 - 600 of 1049 matches
Mail list logo