I don't know if this is pythonic or not, but try something like this:
from math import log
from random import randint
def: skewedrandom(n):
int(log(randrange(1,n), 2))
Play with your log to get the range you want
Cheers,
Cliff
Grant Edwards wrote:
On 2007-08-27, Jun-geun Park [EMAIL
In message [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
What could cause the shell to be
able to resolve the addresses properly, but not python?
nnsswitch.conf ?
How did you test the name resolution in the shell--was it with host
or ping? I would recommend ping, because that would use the
In message [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
try:
for line in open(myFileName):
count += 1
except IOError:
print Can't open myfile
(I know, this is bad, I never close the file, but its just for
illustration).
No, that's fine. The file object returned by open
On 8/27/07, J. Cliff Dyer [EMAIL PROTECTED] wrote:
Play with your log to get the range you want
Here you can get true random numbers (not pseudorandom, they claim
to use a quatum generaton (?)) by fetching them from:
http://random.irb.hr/
They give you a python class t insert into your code,
A python interactive interpreter works by having the user type in some
code, compiling and running that code, then printing the results. For
printing, the results are turned into strings.
I would like make an interpreter which does this, without the last
part: i.e. where the results are
Jun-geun Park wrote:
Ivan Voras wrote:
Hi,
I have a list of items, and need to choose several elements from it,
almost random. The catch is that the elements from the beginning
should have more chance of being selected than those at the end (how
much more? I don't care how the envelope of
On Aug 27, 5:35 pm, [EMAIL PROTECTED] wrote:
I have:
try:
for line in open(myFileName):
count += 1
except IOError:
print Can't open myfile
(I know, this is bad, I never close the file, but its just for
illustration). But then I change it to:
try:
for line in
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] writes:
On Aug 27, 12:32 pm, Larry Bates [EMAIL PROTECTED] wrote:
Changing it to IP gives me the same exact error...
File bin/prgram.py, line 123, in notify
smtp = smtplib.SMTP(XXX.XXX.XXX.XXX)
File /usr/lib/python2.4/smtplib.py,
[EMAIL PROTECTED] writes:
try:
for line in open(myFileName):
count += openAndProcessSubfile(line)
except IOError:
print Can't open myfile
... now the 'except' incorrectly catches errors from
openAndProcessSubfile.
So don't include it. You've discovered a good principle
On Aug 27, 12:59 pm, RyanL [EMAIL PROTECTED] wrote:
I'm a newbie! I have a non-delimited data file that I'd like to
convert to delimited.
Example...
Line in non-delimited file:
01397256359210100534+42050-102800FM-15+1198KAIA
Should be:
On Aug 27, 4:22 pm, [EMAIL PROTECTED] (Douglas Wells) wrote:
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] writes:
On Aug 27, 12:32 pm, Larry Bates [EMAIL PROTECTED] wrote:
Changing it to IP gives me the same exact error...
File bin/prgram.py, line 123, in notify
smtp =
On Aug 27, 4:46 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Mon, 27 Aug 2007 03:05:30 -0300, Mick Duprez [EMAIL PROTECTED]
escribi?:
Thank you very much Gabriel, changing the NULL to None did the trick
(it also helps if I reload the changed module after editing!:( ).
Glad to see it
Johan a écrit :
Hi
I have installed and tested this on centos, fedora and freebsd all
give the same problem so I guess I missed some steps.
I have compiled bot apache (2.2.4) and mod_python (3.3.1) according to
the docs and no problem with this.
But when I have made everything about
I am trying to put together a python program that will be able to ask
for a word and its definition, then save that information into an xml
file for reference. I am not down right set on the file being in xml
format, but xml is the first thing that comes to mind, since I do not
want to use a MySQL
Bruno Desthuilliers a écrit :
Johan a écrit :
Hi
I have installed and tested this on centos, fedora and freebsd all
give the same problem so I guess I missed some steps.
I have compiled bot apache (2.2.4) and mod_python (3.3.1) according to
the docs and no problem with this.
But when I
[EMAIL PROTECTED] wrote:
On Aug 27, 12:47 pm, [EMAIL PROTECTED] wrote:
On Aug 27, 12:32 pm, Larry Bates [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
Hi all,
I'm having trouble with the socket module resolving a hostname. It
seems like this is a system level problem, but I'm not even
Méta-MCI (MVP) wrote:
Salut !
Le deuxième envoi aurait pu être en français.
Cela aurait évité le doublon, tout en maintenant le message.
@+
Michel Claveau
;-)
No:
1) The redundancy is due to the fact that I just moved to another
state/ISP and that ... for some reason, the initial
hg wrote:
Méta-MCI (MVP) wrote:
Salut !
Le deuxième envoi aurait pu être en français.
Cela aurait évité le doublon, tout en maintenant le message.
@+
Michel Claveau
;-)
No:
1) The redundancy is due to the fact that I just moved to another
state/ISP and that ... for some reason,
On Aug 28, 11:00 am, Davy [EMAIL PROTECTED] wrote:
Hi all,
It is well known that Python is appreciated for its merit of concise.
However, I found the over concise code is too hard to understand for
me.
Consider, for instance,
def known_edits2(word):
return set(e2 for e1 in
Hi all,
It is well known that Python is appreciated for its merit of concise.
However, I found the over concise code is too hard to understand for
me.
Consider, for instance,
def known_edits2(word):
return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in
NWORDS)
Shall I
Okay, I know you've guys told me millions of times to read the manual I've
read a lot of it. What do you recommend studying the most? Python is my
goal for the next year in the half. :)
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 24, 3:39 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Your problem is with Apache configuration, not with mod_python. The
AddHandler directive maps dirpath/*.py to your handler. So you have to
call anythinghere.py to trigger the desired behaviour. If you want
*any* url under
Ivan Voras wrote:
I have a list of items, and need to choose several elements from it,
almost random. The catch is that the elements from the beginning
should have more chance of being selected than those at the end (how
much more? I don't care how the envelope of probability looks like at
En Mon, 27 Aug 2007 05:35:51 -0300, Lawrence D'Oliveiro
[EMAIL PROTECTED] escribi�:
In message [EMAIL PROTECTED],
Gabriel
Genellina wrote:
On 22 ago, 11:08, Grant Edwards [EMAIL PROTECTED] wrote:
but I'm a Unix guy who occasionally tries
to ship a Windows version of a Python app: the
Ben Finney wrote:
[EMAIL PROTECTED] writes:
... try to only catch exceptions from the
minimum amount of code that does one discrete action.
try:
input_file = open(my_filename)
except IOError, exc:
print Can't open myfile: %(exc) % locals()
for line in
En Mon, 27 Aug 2007 11:48:46 -0300, Carnell, James E
[EMAIL PROTECTED] escribi�:
Image.open(C:\test.jpg) # this is what I have right now. And it
can't find the file or directory. The file is there (it is everywhere
on my computer now!!!)
Use C:\\test.jpg or rC:\test.jpg or C:/test.jpg
My Linux version is: Debian GNU-Linux
My Python version is: 2.3
Reinstalling Python would be my first option. Any of the versions can
be downloaded from python.org but on debian you should be able to just
use apt-get or one of the GUIs for apt-get.
--
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] writes:
On Aug 27, 4:22 pm, [EMAIL PROTECTED] (Douglas Wells) wrote:
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] writes:
On Aug 27, 12:32 pm, Larry Bates [EMAIL PROTECTED] wrote:
Changing it to IP gives me the same exact error...
En Mon, 27 Aug 2007 15:41:15 -0300, iapain [EMAIL PROTECTED] escribi�:
Taking advantage of stable sorting is totally not a hack. The OP just
tried
the two sorting steps in the wrong order.
I didnt say not to use stable sorting, but write a generic function
and hacky code. It is always
Jun-geun Park wrote:
Ivan Voras wrote:
Hi,
I have a list of items, and need to choose several elements from it,
almost random. The catch is that the elements from the beginning
should have more chance of being selected than those at the end (how
much more? I don't care how the envelope of
On Aug 28, 6:15 am, -b [EMAIL PROTECTED] wrote:
I am trying to put together a python program that will be able to ask
for a word and its definition, then save that information into an xml
file for reference. I am not down right set on the file being in xml
format, but xml is the first thing
En Mon, 27 Aug 2007 15:59:25 -0300, Abel Daniel [EMAIL PROTECTED]
escribi�:
Hi!
A python interactive interpreter works by having the user type in some
code, compiling and running that code, then printing the results. For
printing, the results are turned into strings.
This last stage is
In message [EMAIL PROTECTED], Carl
Banks wrote:
Consider this: is there any other code in your program that has to do
something different based on whether you successfully opened this file
or not? If so, how will you notify it whether the call has succeeded
or not? Very often, the caller
In message [EMAIL PROTECTED], Gabriel
Genellina wrote:
En Mon, 27 Aug 2007 05:35:51 -0300, Lawrence D'Oliveiro
[EMAIL PROTECTED] escribi�:
In message [EMAIL PROTECTED],
Gabriel Genellina wrote:
On 22 ago, 11:08, Grant Edwards [EMAIL PROTECTED] wrote:
but I'm a Unix guy who occasionally
Scott David Daniels [EMAIL PROTECTED] writes:
Actually, this will be followed by some foolishness because
(1) [the print format argument was wrong]
and
(2) [the code attempts to loop over the failed input file anyway]
You're right. Shame on me for posting untested code snippets, Thanks
for
On Mon, 27 Aug 2007 18:15:24 -0700, -b wrote:
I am trying to put together a python program that will be able to ask
for a word and its definition, then save that information into an xml
file for reference. I am not down right set on the file being in xml
format, but xml is the first thing
How come you have to set the initialized created variables to equal the
parameters, shouldn't that be default?
class testing:
def __init__(self,testing):
self.testing = testing
x = testing(testing)
print x.testing
How come self.testing = testing
Can someone explain
In message [EMAIL PROTECTED], Raul Araya
wrote:
Today while trying to install a python based program I got an
error regarding the Python.h file that should be in the /include/Phyton2.3
folder. So I went looking for the file but it wasn't there, I mean the
whole folder /Phyton2.3 inside the
New submission from Gregory P. Smith:
I've converted _bsddb.c to use the py3k buffer API for all data and keys
it takes as input. All tests now fail with this error:
BufferError: Cannot make this object read-only.
This presumably results from this call:
PyObject_GetBuffer(obj, view,
New submission from Gregory P. Smith:
This is my svn diff of a py3k Modules/_bsddb.c converted to use the
buffer API. I'm submitting it here as so it doesn't get misplaced as it
currently won't work until bytes objects support PyBUF_LOCKDATA (a
separate bug)
--
assignee:
Changes by Gregory P. Smith:
--
priority: normal -
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1035
__
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Hye-Shik Chang:
Illegal identifier makes python crash on UTF-8 source codes/interpreters.
Python 3.0x (py3k:57555M, Aug 27 2007, 21:23:47)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
compile(b'#coding:utf-8\n\xfc', '', 'exec')
zsh: segmentation fault (core dumped) ./python
Armin Rigo added the comment:
Assigning to Brett instead of me (according to the tracker history).
--
assignee: arigo - brett.cannon
_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1202533
_
Guido van Rossum added the comment:
Thanks!!
Committed revision 57564.
SocketIO was recently moved to socket.py because that's the only place
that uses it. So I've removed it from io.__all__.
The only other change I applied was related to the isatty check -- you
accidentally changed things
Phillip J. Eby added the comment:
Patch implementing an alternate approach: support automatically
importing __main__ when sys.argv[0] is an importable path. This allows
zip files, directories, and any future importable locations (e.g. URLs)
to be used on the command line. Note that this also
Changes by Phillip J. Eby:
_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1739468
_
___
Python-bugs-list mailing list
Unsubscribe:
Guido van Rossum added the comment:
Committed revision 57570.
I didn't review it though.
--
nosy: +gvanrossum
resolution: - accepted
status: open - closed
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1024
__
Guido van Rossum added the comment:
Committed revision 57574.
--
nosy: +gvanrossum
resolution: - accepted
status: open - closed
_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1739906
_
Alexandre Vassalotti added the comment:
That's why the current behaviour is not correct: When I write('\n'),
getvalue() currently returns '\r\n'.
Oh, I missed your example in your initial message. So yes, I agree that
StringIO shouldn't translate newlines like that. I attached a patch that
New submission from Gregory P. Smith:
The Lib/pdb.py debugger fails in the py3k branch.
Traceback (most recent call last):
File /usr/local/gps/python/py3k/Lib/pdb.py, line 1247, in main
pdb._runscript(mainpyfile)
File /usr/local/gps/python/py3k/Lib/pdb.py, line 1173, in _runscript
Collin Winter added the comment:
I'd like some tests demonstrating where the current implementation fails
and your patch helps, yes.
_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1670765
_
Martin von Gagern added the comment:
Looks like I missed your comments on this patch.
What kind of tests do you have in mind?
Tests demonstrating where current implementation fails and my patch will
help? Or rather tests checking that this patch won't break anything
else? The former would be
Seo Sanghyeon added the comment:
The patch is incorrect since find returns -1 on failure. This is also a
duplicate of #1254718.
--
nosy: +sanxiyn
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1032
__
Martin von Gagern added the comment:
Take the attached test5.eml. Run it through the following python script:
import email
print (email.message_from_file(open(test5.eml)).as_string(False))
The result will have both instances of the X-Long-Line header rewrapped.
As the second instance is
Ismail Donmez added the comment:
This works fine with python 2.4 :
import locale
locale.setlocale(locale.LC_ALL,tr_TR.UTF-8)
'tr_TR.UTF-8'
print uMayıs.upper()
MAYIS
--
nosy: +cartman
_
Tracker [EMAIL PROTECTED]
Guido van Rossum added the comment:
Thanks!
Committed revision 57594.
General note: please run Tools/scripts/reindent.py over your files after
editing so I won't have to.
--
nosy: +gvanrossum
resolution: - accepted
status: open - closed
__
Tracker
Changes by Ali Gholami Rudi:
--
versions: +Python 3.0
_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1774736
_
___
Python-bugs-list mailing list
Unsubscribe:
101 - 157 of 157 matches
Mail list logo