On 02/14/2011 01:41 PM, Karim wrote:
Hello,
As I get no response from the tutor python list, I am continuing to
investigate my problem.
In fact the issue is that there are 2 forms in the interactive page
and my request does nothing
instead I get the interactive page not the submission I ask
s...@uce.gov writes:
> > Perhaps you want those classes to inherit from your base class. Have
> > you done the Python tutorial? It covers inheritance and how to use
> > it.
>
> Yes, I have done subclasing before, and yes ThingyTypeA and B should
> be subclassing Thingy
Then your example still giv
I didn't explain my problem, chose a terrible example. This is more
what I'm trying to do:
Basically the subclass I want to use is based on some of the data I extract
from a blob of data. If I use a function to extract the data before I create
the objects, then I need to do a bunch of assignme
fireinice, 16.02.2011 07:32:
On Feb 16, 1:24 am, fireinice wrote:
Hi, all
I'm just working around to generate some fake file for parsing. and I
notice some weired thing happen.
time = str(random.randint(1000, ))
s_id = str(random.randint(1000, 9
fireinice, 16.02.2011 07:24:
Hi, all
I'm just working around to generate some fake file for parsing. and I
notice some weired thing happen.
time = str(random.randint(1000, ))
s_id = str(random.randint(1000, ))
p_id = str(rando
On Feb 16, 1:24 am, fireinice wrote:
> Hi, all
> I'm just working around to generate some fake file for parsing. and I
> notice some weired thing happen.
> time = str(random.randint(1000, ))
> s_id = str(random.randint(1000, ))
>
Hi..
I am new to python , i have creating one application user
agreement..using Tkinter, The Content
of the agreement will reading one file...Agree button will click means
enable next button. And activate script,
Quit button for exit the program,, Dis agree means one warning message
will show up
Hi, all
I'm just working around to generate some fake file for parsing. and I
notice some weired thing happen.
time = str(random.randint(1000, ))
s_id = str(random.randint(1000, ))
p_id = str(random.randint(1000, 99
Dear all,
I am new to python programming, I am developing some small
application, user agreement using Tkinter ,
totally my application having four buttons AGREE, DISAGREE , QUIT ,NEXT.
AGREE--->>Enable the Next Button
DISAGREE--->> One Waring message will show up yes are no
QUIT >> Quit the ap
s...@uce.gov writes:
> I didn't explain my problem, chose a terrible example. This is more
> what I'm trying to do:
Unfortunately, it's still very contrived, and the names don't give any
suggestion as to what you're trying to achieve. Can you improve on that?
> class ThingyTypeA:
> def __init_
Hans-Peter Jansen wrote:
> Hi,
>
> while I usually cope with the woes of floating point issues, this is
> one, that I didn't expect:
>
round(2.385, 2)
> 2.3799
>
> Doesn't the docs say, it's rounded up for this case?
>
>
> Values are rounded to the closest multiple of 10 to t
On Feb 15, 1:28 pm, Dan Stromberg wrote:
> *ix signals have historically been rather unreliable and troublesome
> when used heavily.
>
> There are BSD signals, SysV signals, and POSIX signals - they all try
> to solve the problems in different ways.
No, there are just signals[1]. There are sever
I didn't explain my problem, chose a terrible example. This is more what I'm
trying to do:
class thingy:
def __init__(self, athingy):
self.basic_extract()
if self.typeof = A
.../...
def basic_extract(self):
# complicated logic to extract data out of the thingy here
On 11-02-15 07:45 PM, alex23 wrote:
Firstly, does MyNumbers _have_ to be a class? Or would a function
acting as a class factory be sufficient?
Yes it does. I didn't explain my problem, chose a terrible example. This is
more what I'm trying to do:
class thingy:
def __init__(self, athingy):
On Feb 16, 2:23 am, 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)
>
> clas
i'm on windows, using active python 2.7.1
i've written a script to copy a folder of files to dest folder..
one if the files in this folder has the section symbol (§, '\x15') as
part of the file name
shutil.copy(src_file, dst_file) "can't find the file specified" when
it does the os.chmod() part,
On 2011-02-16, Hans-Peter Jansen wrote:
> Thanks for the explanation, Benjamin. Not that I like it, but anyway.
> If I hadn't quitted smoking a long time ago, I would go and ask, what
> these engineers smoked during the course of inventing this sh*t.
Like most tools, IEEE floating point works br
On 2011-02-16, Ian Kelly wrote:
> On Tue, Feb 15, 2011 at 4:49 PM, Hans-Peter Jansen wrote:
>>
>> while I usually cope with the woes of floating point issues, this is
>> one, that I didn't expect:
>>
> round(2.385, 2)
>> 2.3799
>>
>> Doesn't the docs say, it's rounded up for this
Andrea Crotti wrote:
> At the moment I have this ugly inliner
> interleaved = ':'.join(orig[x:x+2] for x in range(0, len(orig), 2))
I actually prefer this over every other solution to date. If you feel
its too much behaviour in one line, I sometimes break it out into
separate values to pr
benhoyt wrote:
>This works, but as you can see, it's a bit hacky. Is there a better way to =
>fix it? (I'd like the fix to affect all loggers, including the root logger.=
>)
A simpler solution would be to caclulate the time it takes to the handle
the request using time.clock() and include it in
er
I think you need a NumberFactory that makes SmallNumber and BigNumber
according to the initial value.
?? 2011-2-16 10:23, s...@uce.gov :
How can I do something like this in python:
#!/usr/bin/python3.1
class MyNumbers:
def __init__(self, n):
self.original_value =
alex23 wrote:
> self.__class__ = BigNumbers if n > 100 else SmallThing
That should, of course, be SmallNumbers :)
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 16, 12:23 pm, 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)
>
> cla
s...@uce.gov writes:
> 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)
A class defines a type of objec
On 16/02/2011 02:23, 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 __in
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):
self.size = 'small'
cl
On Wednesday 16 February 2011, 01:24:59 Chris Rebert wrote:
> On Tue, Feb 15, 2011 at 4:09 PM, Chris Rebert
wrote:
> > On Tue, Feb 15, 2011 at 3:49 PM, Hans-Peter Jansen
wrote:
> >> Hi,
> >>
> >> while I usually cope with the woes of floating point issues, this
> >> is
> >>
> >> one, that I did
On Wednesday 16 February 2011, 01:06:08 Benjamin Kaplan wrote:
> On Tue, Feb 15, 2011 at 6:49 PM, Hans-Peter Jansen
wrote:
> > Hi,
> >
> > while I usually cope with the woes of floating point issues, this
> > is
> >
> > one, that I didn't expect:
> round(2.385, 2)
> >
> > 2.3799
On Tue, Feb 15, 2011 at 4:09 PM, Chris Rebert wrote:
> On Tue, Feb 15, 2011 at 3:49 PM, Hans-Peter Jansen wrote:
>> Hi,
>>
>> while I usually cope with the woes of floating point issues, this is
>> one, that I didn't expect:
>>
> round(2.385, 2)
>> 2.3799
>>
>> Doesn't the docs sa
On Tue, Feb 15, 2011 at 3:49 PM, Hans-Peter Jansen wrote:
> Hi,
>
> while I usually cope with the woes of floating point issues, this is
> one, that I didn't expect:
>
round(2.385, 2)
> 2.3799
>
> Doesn't the docs say, it's rounded up for this case?
>
>
> Values are rounded to th
On Tue, Feb 15, 2011 at 4:49 PM, Hans-Peter Jansen wrote:
> Hi,
>
> while I usually cope with the woes of floating point issues, this is
> one, that I didn't expect:
>
round(2.385, 2)
> 2.3799
>
> Doesn't the docs say, it's rounded up for this case?
>
>
> Values are rounded to th
On Tue, Feb 15, 2011 at 6:49 PM, Hans-Peter Jansen wrote:
> Hi,
>
> while I usually cope with the woes of floating point issues, this is
> one, that I didn't expect:
>
round(2.385, 2)
> 2.3799
>
> Doesn't the docs say, it's rounded up for this case?
>
>
> Values are rounded to th
On Wed, 2011-02-16 at 00:49 +0100, Hans-Peter Jansen wrote:
> Hi,
>
> while I usually cope with the woes of floating point issues, this is
> one, that I didn't expect:
>
> >>> round(2.385, 2)
> 2.3799
>
> Doesn't the docs say, it's rounded up for this case?
>
>
> Values are rounde
On Tue, 2011-02-15 at 14:16 -0800, rantingrick wrote:
> On Feb 14, 9:44 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote:
> > On Tue, 15 Feb 2011 09:47:54 +1000, James Mills wrote:
> > > On Tue, Feb 15, 2011 at 9:32 AM, rantingrick
> > > wrote:
> > >> Those who write code bases should "
On Tuesday, February 15, 2011 7:49:34 PM UTC-4, Hans-Peter Jansen wrote:
> Hi,
>
> while I usually cope with the woes of floating point issues, this is
> one, that I didn't expect:
>
> >>> round(2.385, 2)
> 2.3799
>
> Doesn't the docs say, it's rounded up for this case?
The problem
Generally, I prefer map() over list comprehensions since they are more
succinct and run faster for non-trivial examples. However, I've been
considering another use case related to functions in the operator
module. Here are some examples:
[x.method() for x in data]
[x[0] for x in data]
[x.attr fo
Hi,
while I usually cope with the woes of floating point issues, this is
one, that I didn't expect:
>>> round(2.385, 2)
2.3799
Doesn't the docs say, it's rounded up for this case?
Values are rounded to the closest multiple of 10 to the power minus n;
if two multiples are equally
On Tue, Feb 15, 2011 at 1:29 PM, Emile van Sebille wrote:
> On 2/15/2011 10:19 AM Chris Rebert said...
>> On Tue, Feb 15, 2011 at 7:17 AM, Jorge Vargas
>> wrote:
>>> I have the following situation. In a big project that involves many
>>> dependencies (and sadly some sys.module hacks) we have a b
Jorge,
It's been a while since I felt the need to use a Python debugger, but I
could swear that most (all?) Python debuggers allow you to watch a
specific variable.
Check out the debuggers on the following page:
http://wiki.python.org/moin/PythonDebuggers
Malcolm
--
http://mail.python.org/mailm
On Feb 15, 4:16 pm, rantingrick wrote:
> # In Code form.
> if (dev.design_time + dev.test_time) < dev.write_time:
> print('Good Job Skippy!')
> else:
> raise ScriptKiddieError
Oops, you see what i mean!!! :-)
if (dev.design_time + dev.test_time) > dev.write_time:
print('Good Job Sk
On Feb 14, 9:44 pm, Steven D'Aprano wrote:
> On Tue, 15 Feb 2011 09:47:54 +1000, James Mills wrote:
> > On Tue, Feb 15, 2011 at 9:32 AM, rantingrick
> > wrote:
> >> Those who write code bases should "design-in" practicality, re-
> >> usability, and extendability as a forethought and NOT an aftert
It's been too long since I've worked on this. Yep, I forgot to commit.
Thanks,
Beno
On Tue, Feb 15, 2011 at 5:21 PM, Jerry Hill wrote:
> On Tue, Feb 15, 2011 at 3:24 PM, Victor Subervi
> wrote:
> > It builds the table but fails from the first insertion. Trying to insert
> > using that code dire
Emile van Sebille wrote:
> Out of curiosity, if it's immutable, what approach might you try to
> capture/trace reassignment? I've got a toy tracer that breaks with
> simple assignment:
AFAIK you'd have to replace the namespace dictionaries with dictionary-like
things that would react to rebindi
On Tuesday, February 15, 2011 1:44:55 PM UTC-7, Chris Rebert wrote:
> On Tue, Feb 15, 2011 at 12:29 PM, Jeremy wrote:
> > I have a container object. It is quite frequent that I want to call a
> > function on each item in the container. I would like to do this whenever I
> > call a function on
On Tue, 15 Feb 2011 14:32:13 +, Duncan Booth wrote:
>
>> Also, as already shown, the map version is faster.
>
> In most cases the list comprehension is faster. Try timing it.
For an extremely specialised and minimal definition of "most cases".
> C:\Python27>python.exe lib\timeit.py -s "de
On 2/15/2011 10:19 AM Chris Rebert said...
On Tue, Feb 15, 2011 at 7:17 AM, Jorge Vargas wrote:
Hello,
I have the following situation. In a big project that involves many
dependencies (and sadly some sys.module hacks) we have a bug, and it
will really help if i could monitor all changes made t
On Tue, Feb 15, 2011 at 3:24 PM, Victor Subervi wrote:
> It builds the table but fails from the first insertion. Trying to insert
> using that code directly in MySQL does indeed work. Why?
In what way does it fail? Does it give you a stack trace, and if so,
what does it say? Does it create the
On Tue, Feb 15, 2011 at 1:44 PM, Steven D'Aprano
wrote:
> I don't. If you (generic you) have separate "write the code" and "test
> the code" phases, your project is in trouble. You can probably get away
> with it if it's a tiny throw-away script, but for anything more
> substantial, you should be
On Tue, 15 Feb 2011 12:29:36 -0800, Jeremy wrote:
> def __getattr__(self, name):
> for I in self.items:
> # How can I pass arguments to I.__dict__[name]?
> I.__dict__[name]
The same way you would pass arguments to any other function: with
function call syntax.
On 15/02/2011 20:29, Jeremy wrote:
I have a container object. It is quite frequent that I want to call a function
on each item in the container. I would like to do this whenever I call a
function on the container that doesn't exist, i.e., the container would return
an attribute error.
For e
On 15/02/2011 20:24, Victor Subervi wrote:
Hi;
I have a function that calls the following class:
#!/usr/bin/python
import sys,os
sys.path.append(os.getcwd())
import MySQLdb
from login import login
import re, string
def buildTableColorShortOptions():
user, passwd, db, host = login()
datab
On Tue, Feb 15, 2011 at 12:29 PM, Jeremy wrote:
> I have a container object. It is quite frequent that I want to call a
> function on each item in the container. I would like to do this whenever I
> call a function on the container that doesn't exist, i.e., the container
> would return an att
The Python logging module calls time.time() in LogRecord.__init__ to fetch the
timestamp of the log record. However, time.time() isn't particularly accurate
on Windows. We're logging start and end of our requests in our web server,
which can be milliseconds apart, and the log timestamps often sh
On 02/15/2011 12:32 PM, Wanderer wrote:
if f.find(fileBase)> 0:
.find() returns "-1" on failure, not 0. You want ">=" instead of
just ">", or even more readably
if fileBase in f:
-tkc
--
http://mail.python.org/mailman/listinfo/python-list
I have a container object. It is quite frequent that I want to call a function
on each item in the container. I would like to do this whenever I call a
function on the container that doesn't exist, i.e., the container would return
an attribute error.
For example
class Cont(object):
def _
Hi;
I have a function that calls the following class:
#!/usr/bin/python
import sys,os
sys.path.append(os.getcwd())
import MySQLdb
from login import login
import re, string
def buildTableColorShortOptions():
user, passwd, db, host = login()
database = MySQLdb.connect(host, user, passwd, db)
Hi all,
Information on using tkinter for displaying an svg image seems a bit low
spread on the Internet. I recently played around with pygame and svg and
realized, hold on this can be done with tk too. So I thought I post a
little example for future generations :-) (and also have stored at
ht
On 15/02/2011 18:48, Mel wrote:
Wanderer wrote:
I'm using code
def getFiles(self, fileBase):
"""return a list of the filenames in a director containing a
base word
"""
allFiles = os.listdir(self.resultDir)
baseFiles = []
for f in allFiles:
On 15.02.2011 19:12, Panupat Chongstitwattana wrote:
Panupat, please don't top-post, it messes the the natural order of
the discussion. Thanks.
I think the command line should look something along this line
export PYTHONPATH=$HOME/foo/prog/learning_python/:
with a colon at the end.
Nope,
> def getFiles(self, fileBase):
> """return a list of the filenames in a director containing a
> base word
> """
> ...
Have a look at the glob module, it does what you want.
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-li
On 15.02.2011 19:32, Wanderer wrote:
I'm using code
def getFiles(self, fileBase):
"""return a list of the filenames in a director containing a
base word
"""
allFiles = os.listdir(self.resultDir)
baseFiles = []
for f in allFiles:
if
Wanderer wrote:
> I'm using code
>
> def getFiles(self, fileBase):
> """return a list of the filenames in a director containing a
> base word
> """
>
> allFiles = os.listdir(self.resultDir)
> baseFiles = []
> for f in allFiles:
> if f.find(
I'm using code
def getFiles(self, fileBase):
"""return a list of the filenames in a director containing a
base word
"""
allFiles = os.listdir(self.resultDir)
baseFiles = []
for f in allFiles:
if f.find(fileBase) > 0:
baseFile
On Tue, Feb 15, 2011 at 2:57 AM, Dinh wrote:
> Hi,
>
> I currently build a process management system which is able to fork child
> processes (fork()) and keep them alive (waitpid() ).
>
> if pid in self.current_workers:
> os.waitpid(pid, 0)
>
> If a child process dies
On Tue, Feb 15, 2011 at 7:17 AM, Jorge Vargas wrote:
> Hello,
>
> I have the following situation. In a big project that involves many
> dependencies (and sadly some sys.module hacks) we have a bug, and it
> will really help if i could monitor all changes made to that variable.
> Is there a way to
I think the command line should look something along this line
export PYTHONPATH=$HOME/foo/prog/learning_python/:
with a colon at the end.
On Wed, Feb 16, 2011 at 12:49 AM, Tim Hanson wrote:
> I am to the point in _Learning_Python_ where functions are introduced.
>
> I decided to experiment by
I am to the point in _Learning_Python_ where functions are introduced.
I decided to experiment by putting a function into a file and importing it
into Idle. Of course, Idle couldn't find it, so I executed the following
command in Bash:
PYTHONPATH=/home/foo/prog/learning_python
export PYTHONP
On 15 Feb, 05:24, Akand Islam wrote:
> Dear Sturlamolden,
> Thanks for reply. I will follow-up if I need further assistance.
>
> -- Akand
You should rather use the SciPy user mailing list than
comp.lang.python for this.
Sturla
--
http://mail.python.org/mailman/listinfo/python-list
I released Oktest 0.8.0.
http://pypi.python.org/pypi/Oktest/
http://packages.python.org/Oktest/
Oktest is a new-style testing library for Python.
::
from oktest import ok, NG
ok (x) > 0 # same as assert_(x > 0)
ok (s) == 'foo'# same as assertEqual(s, 'foo')
>> I find:
>>
>> map(func, iterable)
>>
>> to be "neater" than:
>>
>> [func(item) for item in iterable]
>>
>> If nothing else, the "map" version is shorter.
>That's only true if you wanted to call an existing function. If you wanted
>to do something involving a more complex expression that
Hello,
I have the following situation. In a big project that involves many
dependencies (and sadly some sys.module hacks) we have a bug, and it
will really help if i could monitor all changes made to that variable.
Is there a way to trace those changes ?
--
http://mail.python.org/mailman/listinfo
On 15/02/2011 09:53, Andrea Crotti wrote:
Just a curiosity not a real problem, I want to pass from a string like
xxaabbddee
to
xx:aa:bb:dd:ee
so every two characters insert a ":".
At the moment I have this ugly inliner
interleaved = ':'.join(orig[x:x+2] for x in range(0, len(orig), 2))
On Tue, 2011-02-15 at 08:36 +, Duncan Booth wrote:
> Westley Martínez wrote:
>
> >> In the end i promise they will respect you more for your honesty. And
> >> it will not be a respect forged from fear, no, it will be something
> >> greater! A respect forged from collaboration. A respect of co
Gerald Britton wrote:
> I find:
>
> map(func, iterable)
>
> to be "neater" than:
>
> [func(item) for item in iterable]
>
> If nothing else, the "map" version is shorter.
That's only true if you wanted to call an existing function. If you wanted
to do something involving a more compl
I find:
map(func, iterable)
to be "neater" than:
[func(item) for item in iterable]
If nothing else, the "map" version is shorter. More importantly, in
the 2.x series (which I am often limited to for compatibility
reasons), the variable used in the list comprehension leaks to the
follow
On Feb 15, 10:09 am, Wojciech Muła
wrote:
> import re
>
> s = 'xxaabbddee'
> m = re.compile("(..)")
> s1 = m.sub("\\1:", s)[:-1]
One can modify this slightly:
s = 'xxaabbddee'
m = re.compile('..')
s1 = ':'.join(m.findall(s))
Depending on one's taste this could be clearer. The more general
answe
Dear Python users,
I am pleased to announce version 10.1 of the data plotting software
DISLIN.
DISLIN is a high-level and easy to use plotting library for
displaying data as curves, bar graphs, pie charts, 3D-colour plots,
surfaces, contours and maps. Several output formats are supported
such as
On 13 fév, 06:20, joy99 wrote:
> On Feb 13, 1:29 am, aspineux wrote:
>
>
>
>
>
> > Hi
>
> > I'm releasing a .exe made with py2exe myself an got this problem too.
> > 99% of the time the required DLL is already installed by another
> > application and you don't need to care about it.
> > The 1% is
Hi,
I currently build a process management system which is able to fork child
processes (fork()) and keep them alive (waitpid() ).
if pid in self.current_workers:
os.waitpid(pid, 0)
If a child process dies, it should trigger a SIGCHLD signal and a handler is
install
Hello,
How about this:
>>> str = 'xxaabbddee'
>>> ':'.join(map(''.join, zip(str[::2], str[1::2])))
In my example, it should not matter that the letters are repeating.
On Tue, Feb 15, 2011 at 11:53 AM, Andrea Crotti
wrote:
> Just a curiosity not a real problem, I want to pass from a string like
On Tue, 15 Feb 2011 10:53:56 +0100 Andrea Crotti
wrote:
> Just a curiosity not a real problem, I want to pass from a string like
>
> xxaabbddee
> to
> xx:aa:bb:dd:ee
>
> so every two characters insert a ":".
> At the moment I have this ugly inliner
> interleaved = ':'.join(orig[x:x+2] f
Just a curiosity not a real problem, I want to pass from a string like
xxaabbddee
to
xx:aa:bb:dd:ee
so every two characters insert a ":".
At the moment I have this ugly inliner
interleaved = ':'.join(orig[x:x+2] for x in range(0, len(orig), 2))
but also something like this would work
[''
I answer myself to put my question on top of the list again.
On Feb 12, 7:47 pm, aspineux wrote:
> Python 2.6 can run a zip file, searching for __main__.py in the root
> of the zip archive and running it.
> How can I create such an archive using distutils (and not
> setuptools) ?
>
> If I use
>
Il giorno 15/feb/2011, alle ore 04.10, Ben Finney ha scritto:
> Andrea Crotti writes:
> The ‘map’ builtin is deprecated; using a list comprehension is neater
> and more efficient.
Ok well it depends,
map(int, biglist)
is better than:
[int(x) for x in biglist]
at least for me.
Efficiency is pro
Westley Martínez wrote:
>> In the end i promise they will respect you more for your honesty. And
>> it will not be a respect forged from fear, no, it will be something
>> greater! A respect forged from collaboration. A respect of comrades in
>> arms. This is the future i bring to c.l.py!
> HEIL D
85 matches
Mail list logo