Payal writes:
[...]
> Thanks a lot for the mails all of you.
> Someone commented that wxpython occassionally shows it C/C++ roots. Will
> that haunt me cos' I have zero knowledge of C/C++.
>
> What about py-gtk? Is it more pythonic to learn and hence easy?
I've used wx and pygtk and don't reall
Hello everyone,
I have some code that's calling fcntl.ioctl. I need to pass a nested
structure as the 3rd argument of the function. Something like this
typedef struct coordinates{
int x;
int y;
} coordinates;
typedef struct point{
int amp;
coordinates* coord;
} point;
How would I
Angus Rodgers wrote:
[..]
This feels like a bit of a cheat, as if I am trying to program in
Python as if it were some other more familiar language. Should I
have coded this differently?
I can't offer anything concrete but here are some things that occur to
me at a glance.
0. You can try to
Kent Johnson wrote:
[..]
Why not just return the value from the function and pass it up the
call chain? If a call fails return None. Something like this:
That's what I ended up doing but the first thing occurred to me and I
was just wondering if there's any production code that relies on the
Hello everyone,
Would it be considered unorthodox or 'wrong' in some sense for me to use
an exception to unwind the stack and return to a caller for a recursive
function?
I need to do a depth first search and when I find the right element to
just stop the whole thing, and get back to the cal
MK wrote:
Hi there,
i am using this code to send an "cat > ThisIsMyUrl" with popen.
Of cos cat now waits for the CTRL+D command.
How can i send this command ?
Wouldn't it be better if you directly opened the "ThisIsMyUrl" file and
wrote the text into it rather than rely on shelling out for t
Greetings Sudanshu,
sudhanshu gautam wrote:
when we work on the oops in the python then we have to pass the first
parameter as a self then the value of the other parameters .
Well, not explicitly. If you're familiar with OOPS in C++, self is
analogous to the "this" pointer there. Also, you ne
Oxymoron wrote:
I think you're looking for refactoring features, in this particular
case, a compose method/function refactor.
Generally, generic editors will have trouble doing this right since it
requires some inferencing capability on the selected code, your best
bet is probably googling Pytho
Emad Nawfal (عماد نوفل) wrote:
Hi Tutors,
I've never had a situation in which this was useful for me, but I'm just
curious.
If there is a text file that has a list or number of lists in it, is
there is a way to read the lists in the file as lists, and not as a
string. Sample file attached.
A.T.Hofkamp wrote:
write the output to a temporary file while reading the input, then
rename the temporary file.
This I believe is what the fileinput module does when you use it with
the inplace parameter set to 1.
--
~noufal
http://nibrahim.net.in/
Bala subramanian wrote:
Hello all,
query 1) How should i overwrite the input file
I want to open 5 files one by one, do some operation on the lines and
write the modified lines on the same file (overwritting). Can some
please tell me how to do it.
import fileinput
pat1=" R"
pat2="U5"
pat3="A
Eric Dorsey wrote:
I am trying to teach myself Linux, and so I'm running Ubuntu (Gutsy
Gibbon) as a virtual machine. I went to terminal, started up Python and
realized it was version 2.5 so I thought I'd just upgrade to 2.6.1 After
doing some Googling around, it seems that Ubuntu is highly reli
bob gailer wrote:
2) "looks bad" and "is ugly" are emotional responses. What are you
feeling and wanting when you say those things?
It's hard for me to qualify really but my general idea of list
comprehensions is that they transform and filter lists creating other lists.
For instance, I'd
Hello everyone,
What is the pythonic was of selecting the first element of a
list matching some condition?
I often end up using
[x for x in lst if cond(x)][0]
This looks bad and raises IndexError if nothing is found which
is ugly too.
Thanks.
--
~noufal
http://ni
Wayne Watson wrote:
Is it possible to do as in Subject on Win XP? Say, 2.4 and 2.5.
--
You can create virtual installations of Python which might work for you.
I do it for custom package installation etc.
The virtualenv pakcage is what I use.
http://pypi.python.org/pypi/virtualenv
--
~noufal
Jim Morcombe wrote:
I want to write a program that helps teach students how to draw ray
diagrams for lenses and mirrors. Vpython seems to be used for a number
of physics simulations, but may be overkill for my application.
Although there are a few 3D things I would like to do, most just
invol
Alan Gauld wrote:
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
I want to remove whole numbers from text but retain numbers
attached to words.
Is this a homework?
If so we can only offer suggestions to direction but not give solutions.
What is the best to do this using re?
Yes, use re to d
Morgan Thorpe wrote:
Hello.
I'm am very new to the whole programming sence.
Welcome. :)
I am trying to catch on but as soon as i want to write a program i've
been told to use like 'notepad' in windows XP and save it as a .py file
i have gotten this far. Am i wrong so far?
It's fine so fa
amit sethi wrote:
Hi list ,
Can someone give me an idea about the audio libraries in python . I
tried using pymedia . What are the options available .
These may be a little heavy duty for you but they do audio.
0. Pyglet (Full windowing and multimedia library) - http://pyglet.org/
1. Gstream
Kent Johnson wrote:
On Wed, Jun 11, 2008 at 3:58 PM, Stephen Nelson-Smith
<[EMAIL PROTECTED]> wrote:
Hello,
This has to include resources which have not been visited, as the
point is to clean out old stuff.
wouldn't a 'find' for files with a an ancient access time be a better
way of findin
Fiyawerx wrote:
> I've been over google for hours now, and I'm sort of at a lull in my
> learning, as I don't really have a current "goal". I know I could set
> some easy goal like to learn a specific function or feature, but I still
> have a hard time with that approach also. I was wondering if
Hello everyone,
This is probably something simple but I can't seem to find a way to
format a timedelta object for printing? I need to be able to print it in
a HH:MM:SS format but without the microseconds part (which is what you
get if you str() it).
Any pointers?
Thanks.
--
~noufal
ht
wormwood_3 wrote:
> Now, what I would like to do is instead send this output to one or
> more of the standard linux log files. First though, I am wondering, what
> is the standard procedure in a case like this?
You can either have a config file to specify a log area or use syslog to
do the logg
Kent Johnson wrote:
> Kamal wrote:
>> hello everyone,
>>
>> Is there a method in Python which does what
>> setInterval('someFunction()',5000) does in Javascript.
>>
>> Basically, I want to call functionOne() every x minutes, and wondering
>> whats the best way to do it.
You can also look at the sc
bhaaluu wrote:
> On 10/2/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>> traceback.print_stack() prints the stack trace to the current point of
>> execution. No forced error or drama needed :-)
>>
>> Kent
>
> Exactly how is this used, please?
>
> Traceback (most recent call last):
> File "print_
János Juhász wrote:
> Dear Tutors,
>
> I would like to make a new class instance, where
> the intance attributes coming from the kwargs hash.
>
> class ADUser:
> def __init__(self, **kwargs):
> for key in kwargs.keys():
> self.key = kwargs[k]
>
> a = ADUser(name='papa')
>
wormwood_3 wrote:
> Hello all,
> I am working on a very simple CGI script. The site I want to use it
> on is a shared linux host, but I confirmed that .py files in the
> right dir with the right permissions and shebang execute just fine,
> Hello World sort of tests were successful.
Those are the f
Fangwen Lu wrote:
> Dear all-
>
> I want to do some loops. Each loop will generate a tuple. Eventually I
> want to put tuples together in a higher level of tuple. Do you know how
> to do this?
>
> Say a=(1,2,3), b=(4,3,2),c=(9,5,6). I want to get a tuple as ((1,2,3),
> (4,3,2),(9,5,6)).
>
Robert Jackson wrote:
> I'm trying to get some pretty colored output for a Linux console / terminal
> window. Google searches only reveal the curses module to colorize output.
>
> Is there a simpler way? Curses seems to be FAR too powerful for what it is I
> want to do (simply to colorize a fe
bhaaluu wrote:
> Can you explain how this works? How would this be written in
> a "conventional" way?
I'm not sure if this is addressed to me but I'll reply anyway. :)
foo = [1,2,3,4,5,6]
[(foo[i],foo[i+1]) for i in range(0,len(foo),2)]
range(0,len(foo)) would create a list of consecut
Fangwen Lu wrote:
> Dear all-
>
> If I have an array array([1, 2, 3, 4, 5, 6]), and I want to get
> ((1,2),(3,4),(5,6)). What should I do?
This seems to work although I'd like comments from the more experienced
Pythonistas out there.
>>> foo
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> [(foo[i],foo[i+1]
Tim wrote:
> Hello,
> I have a print statement where I use concatenation of variables with "+" to
> avoid extra whitespaces. The variables are mixed (float/int).
>
> How can I convert them all to strings to have a clean print statement?
>
> example
> print str(var1)+"and this "+str(var2)+"needs t
林培恒 wrote:
> On Mon, 24 Sep 2007, Terry Carroll write:
>
>> My math is rusty. Is there a concept of "greater than"
>> or "largest" in complex numbers on different axis? Which
>> is larger, 4+2i or 2+4i?
>
> In fact, complex numbers can not compare directly. People always compare
> complex numbe
dave selby wrote:
> Can anyone tell me where the documentation for pythons xf86misc module
> is, ie what methods are avalible ?
I've not used this module you mention myself but if it's got docstrings
and inline documentation, you can get help by importing the module and
then doing a
help(xf86mi
Kent Johnson wrote:
> Noufal Ibrahim wrote:
>> My question is whether this is a valid use for a decorator and whether
>> this kind of usage is pythonic. If not, are there any better ways to
>> do this?
>
> It seems like a bit of a hack to me. I guess you change the
Hello everyone,
I have a question regarding the use of some decorators.
In my program, I have functions like this
def process_command_line(...):
...
def run_command(...):
...
def update_db(...):
...
These functions are for various stages of the program. Now, I need
to
Rikard Bosnjakovic wrote:
> On 10/09/2007, Lawrence Barrott <[EMAIL PROTECTED]> wrote:
>
>> is it possible to run other non-python files using python such as .exe or
>> other files.
>
> Have a look at os.system().
>
Or more generally, the subprocess module.
--
~noufal
chinni wrote:
>
>
> In Advance Sorting by giving the keywords to sort the list.But, iam
> getting the fallowing errors
>
> >>> x = ['srikanth', 'kumar', 'muppandam', 'will', 'be', 'a']
> >>> x.sort(key=len)
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: sort() tak
[EMAIL PROTECTED] wrote:
> Hi!
>
>
> What's the point in having a server app between the user frontend and
> a database backend? (As is the case of TinyERP wich is writen in
> python-GTK)
>
> Can't simillar functionality be achieved without that server? What are
> the main pro's and con's?
Ara Kooser wrote:
> Hello all,
>
>I am working on trying to understand classes by creating a
> character generator for a rpg. I know I am doing something silly but I
> am not sure what. When I run the program I and type no when prompted I
> get the following message:
> Traceback (most recent c
János Juhász wrote:
> Dear Tutors!
>
> I know a python list is a mutable object.
array = [1,2,3,4,5]
>
> So I can modify any item in it.
for index in range(len(array)): array[index] *= 2
> ...
array
> [2, 4, 6, 8, 10]
>
> So I typed this:
for item in array: item *= 2
> ...
Vincent Gulinao wrote:
>
>
> Sorry, I just started experimenting on Python classes...
>
> Is there any way a reference to a class attribute ([class].[attribute])
> be treated like a method ([class].[method]())?
>
> I have a class with DB component. Some of its attributes are derived
> from DB
Stephen McInerney wrote:
> Hi Alan,
[..]
> How can we address that reasonably and succinctly without polluting the doc
> with language-migration-specific details, that is a worthy question... I
> believe we can do a better job simply by grouping and highlighting related
> alternative concepts li
Eric Brunson wrote:
> Noufal Ibrahim wrote:
[..]
>> def createSignalDelegator(p):
>> def sighandler(signal,frame,pmake = p):
>> os.kill(pmake.pid,signal)
>> return sighandler
>>
>> pmake = subprocess.Popen(pmake_cmd, bufsize =
Hello everyone,
I've come across a situation which is somewhat confusing to me.
I googled for some details and came across another email thread on
this very list but couldn't really glean a solution out of it.
I have a program (a compiled binary) for which I need to write a
wrapper (in
Beanan O Loughlin wrote:
> hi all,
>
> I am new to python, and indeed to programming, but i have a question
> regarding correlation matrices.
>
> If i have a column vector
>
> x=[1;2;3;4;5]
>
> and its transpose row vector
>
> xt=[1,2,3,4,5]
>
> is there a simple way in python to create a 5x
kevin parks wrote:
> With sincere apologies for such a basic question, and one i will
> admit that i asked once before, moons ago. But even after googling
> around a bit i don't understand what the right answer is, or if i
> once did, can't recall it now..
[..]
>
> For some reason i feel li
Hello everyone,
I seem to recall that there was a site (on the python wiki IIRC) that
listed relatively simple python bugs (in the actual C code inside the
interpreter) that needed to be fixed. It was advertised as good starting
point for novices. I can't seem to find it. Does anyone her
Hello everyone,
A couple of months ago, I had posted on this list asking about the
usefulness of such a program. Something similar to TclTutor
(http://www.msen.com/~clif/TclTutor.html) for python.
I've spent some time on this and have come up with a crude first
version. I'd appreciate if some
OkaMthembo wrote:
> hi pythonistas!
>
> this is my first post. please could you tell me which is the best
> lightweight python web framework? also, which is the best templating
> language for python? (which can handle other data formats in addition to
> text). so far im lured by Cheetah, although
Kopalle Narasimha wrote:
> Hello, Everyone.
>
> I have a strange problem with floating point numbers. Please help me.
> I tried the following at the python prompt:
>
> Case 1:
4.5/2.0 #Gives quotient
> Answer: 2.25
>
> Case 2:
4.5%2.0 #Gives Remainder
> Answer: 0.5
>
I
Asrarahmed Kadri wrote:
> Hi,
>
> I want to extract hh:mm:ss from below mentioned code:
>
> import datetime
t = datetime.datetime.now()
print t
> 2006-11-16 16:59:02.843000
>
> How to do it?
Did you read the documentation and try something out before posting this
question on the li
Asrarahmed Kadri wrote:
>
>
>
> Hi Folks,
>
>
> I have a textbox and a button (in tkinter). What I want is the following
> functionality: The user enters a number in the text box and presses the
> button. The event will call a function called "adder" and when the user
> enters another val
Noufal Ibrahim airtelbroadband.in> writes:
>
> Greetings everyone,
>I'm using the python standard logging package for a personal project
> of mine and have initialised it like so.
>
> logger = logging.getLogger("pydagogue")
> handler = logging
Greetings everyone,
I'm using the python standard logging package for a personal project
of mine and have initialised it like so.
logger = logging.getLogger("pydagogue")
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("[%(levelname)s]%(pathname)s:%(lineno)d
%(message)s
max . wrote:
> first off i just started looking for Tkinter tutorials but havent found
> much and what i have found was not very good if anyone knows og any
> Tkinter tutorials pleas let me know
Try this for a good tutorial
http://www.pythonware.com/library/tkinter/introduction/
Peace.
_
Greetings everyone,
I'm working on a little project that's similar to tcltutor for python.
I have a string which has some python code. I "compile" and "eval" this
to get the output. So far so good. However, when this happens, the
evaluation is happening in the current namespace so I'm afraid of
Greetings everyone,
I'm working on a little project that's similar to tcltutor for python.
I have a string which has some python code. I "compile" and "eval" this
to get the output. So far so good. However, when this happens, the
evaluation is happening in the current namespace so I'm afraid of
Greetings all,
A friend here is trying to debug a rather badly written python program
which spawns off lots of threads here and there. Are there any
frameworks that I can reccommend that would ease his pain?
On a more general note, it seems rather strange that I can't quickly
google and f
On Wed, April 12, 2006 2:42 pm, Kaushal Shriyan wrote:
list[:] --> Does this mean its list[0:0]
> ['a', 'b', 'c', 'd', 'e', 'f'] > I didnot understood this
I remember you once asked another question related to sequence slices and
I mentioned the effects of slicing with no indices. You
On Tue, April 11, 2006 2:49 pm, Kaushal Shriyan wrote:
> Hi All
>
> I am referring to http://www.ibiblio.org/obp/thinkCSpy/chap09.htm
>
tuple = ('a', 'b', 'c', 'd', 'e')
tuple[0]
> 'a'
>
>
> And the slice operator selects a range of elements.
>
tuple[1:3]
> ('b', 'c')
>
>
> But if w
On Fri, April 7, 2006 8:23 pm, Carlos Benevides wrote:
> Hi,
>
> Can someone tell me what the r before the expression means, as in
> "re.compile(r'(\.exe|\.zip|\.pif|\.scr|\.ps|\.pdf|\.ppt)$')"?
r is the way of making a string "raw". This means that escape characters
will not be interpreted. Here
On Wed, April 5, 2006 5:02 pm, Keo Sophon wrote:
> Hi,
>
> How to convert a decimal number to hexadecimal, octal and vice versa?
>>> foo = 2
>>> str(foo) # Integer to string
'2'
>>> oct(15) # Integer to octal
'017'
>>> hex(15) # Integer to hex
'0xf'
>>> int(0xf) # Hex to decimal integer
--
-
On Wed, March 29, 2006 2:50 pm, Kaushal Shriyan wrote:
> Hi
>
> I am unable to execute the below code, I have put this in test.py file
> and made it executable, when I run this I see no output, Please
> explain me as what is exactly going on with the below code
>
> The below code is from http://ww
On Wed, March 29, 2006 4:35 am, Anna Ravenscroft wrote:
> There are several of us on the edupython list who want something like this
> but it hasn't (to my knowledge) been created yet. The best things out
> there
> so far, are livewires, guido von robot, and rur-ple. If you're
> interested
> in
Greetings all,
Are there any programs for python that offer an "interactive" tutorial?
Something on the lines of the builtin emacs tutorial (which is
basically just a buffer that tells you to try this and try that with
itself) or the Inkscape tutorial (which is an SVG document that comes
along w
On Mon, March 27, 2006 4:39 pm, Kaushal Shriyan wrote:
> Hi
>
> I am a novice in Python, Which is the best source of learning python
> for a beginner
If you're already a "programmer", then the python tutorial at
http://docs.python.org/tut/tut.html + a working python installation is
enough IMHO.
On Wed, March 22, 2006 12:11 pm, Kaushal Shriyan wrote:
> Hi
>
> I am new to python and I am going through the URL
> http://www.ibiblio.org/obp/thinkCSpy/index.htm, At the moment
> I am going through the Chapter 7 Strings, I am stuck with understanding
> slice which is a part of a String, I am not
On Fri, March 17, 2006 1:06 pm, fortezza-pyt wrote:
> If there a semi-standard way to test if a file system has been mounted
> or not using Python? In the Linux command line, I can type "mount" and
> see all mounted file system, and then see if the one I am looking for is
> in the list. While I co
On Thu, March 2, 2006 3:55 pm, Ben Vinger wrote:
> Hello
>
> I want myfunction in the pseudocode below return something different if it
> was called from indexfunction.
I'm new to this but maybe it would be good if you passed the appropriate
"version" of "myfunction" to indexfunction from where t
70 matches
Mail list logo