there is the "this" keyword which allows an object
to refer to itself. Does anyone know if there is a way to use a similar
type of keyword to have the PythonInterpreter refer to itself?
Thanks,
Wojciech
P.S.
If there is a more appropriate newsgroup to which I should post this,
please l
Hi everyone,
Ah, after some more searching and programming, I got it:
PythonInterpreter py = new PythonInterpreter();
py.set("interpreter", py);
Thanks,
Wojciech
[EMAIL PROTECTED] wrote:
> Hi everyone,
>
> I apologize if this is a bit off-topic. I am currently workin
Greg Lindstrom wrote:
> There does not appear to be a simple way to merge many pdf's into one.
Program pdftk can merge pdf's, but I have never tried it.
You may also use pdflatex --- there is a package called pdfpages
provides powerful command \includepdf.
w.
--
http://mail.python.org/mailman/
drife wrote:
> [...]
> for row in range(len(Y)):
> for col in range(0,row):
In this case you should use 'xrange' instead 'range'.
w.
--
http://mail.python.org/mailman/listinfo/python-list
jdonnell wrote:
> I want to check if a value is in an array. I'm currently doing it as
> follows, but I just don't like this way of doing it. It seems
> unpythonic.
>
> fieldIsRequired = true
> try:
> notRequiredAry.index(k)
> fieldIsRequired = false
> except ValueError:
> pass
>
> #
On 19.02.2014 09:14, Sujith S wrote:
> Hi,
>
> I am new to programming and python. I am looking for a python script to do
> ssh/telnet to a network equipment ? I know tcl/perl does this using
> expect/send.
>
> Do we have expect available in python as well or need to use some other
> method ?
On 19/07/14 11:52, Jerry lu wrote:
Ok so i am trying to learn this and i do not understand some of it. I also
tried to searched the web but i couldnt find any answers.
1. I dont understand when i will need to use a function that returns another
function.
eg
def outer():
mat(x))
... return x
...
>>> h = outer(f, g)
>>> h("test")
g (test) called
f (test) called
'test'
cheers
Wojciech
--
https://mail.python.org/mailman/listinfo/python-list
r function")
... return f(*args, **kwargs)
... return inner
...
>>> def myfunc(x):
... print("Myfunc", x)
...
>>> myfunc = outer(myfunc)
>>> myfunc("test")
inner function
Myfunc test
cheers
Wojciech
and also with the first example
getCompletedTime(start, end): return "Time completed:", str(end -
start)
if you need to print just add print, if you want result from this
function somewhere else you got it. adding additional arguments
necessary adds complexity. do you really need it. Keep it simple stupid
expression can be applied everywhere.
cheers
Wojciech
--
https://mail.python.org/mailman/listinfo/python-list
[[[54, 55, 56],
[57, 58, 59],
[60, 61, 62]],
[[63, 64, 65],
[66, 67, 68],
[69, 70, 71]],
[[72, 73, 74],
[75, 76, 77],
[78, 79, 80)
>>> f = a.flat
>>> for i in f:
...print(i)
0
1
2
..
98
99
cheers
[EMAIL PROTECTED] wrote:
> Now I went to Python Library Reference and searched for "__add__" but
> got zero hits.
http://python.org/doc/2.4.2/ref/specialnames.html
--
http://mail.python.org/mailman/listinfo/python-list
Does anybody know some GUI (preferably QT) application which can be
use to explore pickled python objects? Similar functionality has a
PyDev Debugger in Eclipse, but I would like to have a standalone
application. I know that it is not hard to write it, but I don't want
to again invent a wheel ;o)
Alistair King wrote:
> is there a simple way of creating global variables within a function?
def foo(name):
globals()[name] = "xxx"
globals()[name + 'aa'] = "yyy"
globals()[name + 'ab'] = "zzz"
--
http://mail.python.org/mailman/listinfo/python-list
Tim Chase wrote:
> print "a = %s" % repr(a)
or
print "a = %r" % (a,)
--
http://mail.python.org/mailman/listinfo/python-list
Nick Craig-Wood wrote:
>> It's very mature, full-featured, and portable, and fairly easy to
>> learn as well.
>
> ...with native look and feel on each platform unlike GTK / TK
AFAIK Tk 8 uses platform's native widgets.
w.
--
http://mail.python.org/mailman/listinfo/python-list
Mudcat wrote:
> [...]
You have to set cursor once, Tk change it automatically:
> def buildFrame(self):
> self.f = Frame(self.master, height=32, width=32, relief=RIDGE,
> borderwidth=2)
> self.f.place(relx=.5,rely=.5)
#self.f.bind( '', self.enterFr
Mudcat wrote:
> I have also determined that this is not a problem if the button is not
> packed inside the frame. So somehow the interaction of the internal
> button is causing this problem.
Problem is really strange, and seems to be a Tk issue, not Tkinter.
I've observed that if method configure
fl1p-fl0p wrote:
> import math
> math.pow(34564323, 456356)
>
> will give math range error.
>
> how can i force python to process huge integers without math range
> error? Any modules i can use possibly?
You have to use operator **, i.e. 34564323**456356
--
http://mail.python.org/mailman/listinfo
[EMAIL PROTECTED] wrote:
> The problem is negative values. If the unit returns the hex value 'e7',
> it means -25, but python says it's 231:
> ---
int('e7', 16)
> 231
> ---
>
> Does anyone have a clue a to what I need to do?
def u2(x):
i
vertigo wrote:
> i have:
> x = zeros([3,4],Float)
>
> how can i check how many rows and columns x have ?
> (what is the X and Y size of that table) ?
Data member x.shape (tuple) contains
dimensions of array.
--
http://mail.python.org/mailman/listinfo/python-list
Steve Bergman wrote:
> I'm looking for a module to do fuzzy comparison of strings. [...]
Check module difflib, it returns difference between two sequences.
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Matthias Vodel wrote:
>
>> I want to change the beginning/end-coordinates of a canvas.line item.
>>
>> Something like:
>>
>> self.myCanvas.itemconfigure(item_id, coords=(x1_new, y1_new, x2_new, y2_new))
>
> self.myCanvas.coords(item_id, x1_new, y1_new, x2_new, y2_new)
Yo
abcd wrote:
> I am using fnmatch.fnmatch to find some files. The only problem I have
> is that it only takes one pattern...so if I want to search using
> multiple patterns I have to do something like
>
> patterns = ['abc*.txt', 'foo*']
>
> for p in patterns:
> if fnmatch.fnmatch(some_file
stricted mode
Is there any way to avoid this mode ?
--
___
* Wojciech Pawlikowski :: :: GG: 4155781 *
* http://www.knockdownhc.com || http://www.kingofthehillhc.com *
* "Loved by a few, Hated by many, But respected by ALL" *
--
http://mail.python.org/mailman/listinfo/python-list
O.R.Senthil Kumaran wrote:
> Any suggestions on how can i make this checkbutton effect.
> 1) Press Enable IP, the Label IP should be shown.
> 2) Toggle Enable IP (So that its unset). the Label IP should not be shown.
>
> #!/usr/bin/python
> from Tkinter import *
> root = Tk()
> root.title('somethi
[EMAIL PROTECTED] wrote:
> I am playing with the atexit module but I don't find a way to see the
> difference
> between a script calling sys.exit() and the interpreting
> arriving at the end
> of the source code file. This has a semantic difference for my
> applications.
> Is there a way to determi
Matthew Wilson wrote:
> I want to write a function that each time it gets called, it returns a
> random choice of 1 to 5 words from a list of words.
>
> I can write this easily using for loops and random.choice(wordlist) and
> random.randint(1, 5).
>
> But I want to know how to do this using iterto
abcd wrote:
> My regex so far is: src=\"(.*)\" however the group in this case
> would end up being, image/blah/a.jpg" id="d">blah blah blah a>.
>
> how can I tell the regex group (.*) to end when it gets to the first
> " ?
Use non-greedy matching, i.e. src=\"(.*?)\" (question mark af
Gigs_ wrote:
> I'm working on tkinter paint program, mostly to learn tkinter canvas.
> I have method which create buttons for oval, rectangle, line, polygon etc.
> How to make oval button to be sunken when i click it and to remain
> sunken until i click on another button (like rectangle and than i
escalation746 wrote:
> def ViewValuable():
[...]
> code = """
> Hello()
> Plus()
> Valuable()
> """
These names don't match. I replaced Valuable() with proper name,
and everything work fine.
w.
--
http://mail.python.org/mailman/listinfo/python-list
Helmut Jarausch wrote:
> Hi,
>
> I'm looking for an elegant solution to the following (quite common)
> problem:
>
> Given a string of substrings separated by white space,
> split this into tuple/list of elements.
> The problem are quoted substrings like
>
> abc "xy z" "1 2 3" "a \" x"
>
> should
frikk wrote:
> [...]
> As you can see- I am doing nothing other than drawing a lot of
> rectangles on the canvas.
You aren't drawing, but **creating** rectangle objects, as
a meth. name suggests. You find more info at tkinter.effbot.org.
> [...]
>
> def clear_grid():
canv.delete(ALL)
swiftset wrote:
> I'm try to convert a glyph into a format I can easily numerically
> manipulate. So far I've figured out how to use ttfquery to get a list
> that represents the outline of a contour in a glyph:
>
> from ttfquery import describe, glyphquery, glyph
> f = describe.openFont("/usr/shar
ianaré wrote:
> like this:
>
>
> list = ["Replace", "ChangeCase", "Move"]
> textVariable = list[n]
> self.operations.insert(pos, operations.[textVariable].Panel(self,
> main))
>
> Is something sort of like that possible?
Yes:
self.operations.insert(
pos,
getattr(operations, tex
Paul Kozik wrote:
> However, if I use xml.minidom.parse to parse the xml document, change
> a few attributes with setAttribute, then write back with toprettyxml,
> my XML file gets loaded up with spaces between many of the elements.
Use 'toxml' method, that writes XML document without any modifica
Fabian Braennstroem wrote:
> Now, I would like to improve it by searching for different 'real'
> patterns just like using 'ls' in bash. E.g. the entry
> 'car*.pdf' should select all pdf files with a beginning 'car'.
> Does anyone have an idea, how to do it?
Use module glob.
--
http://mail.python.
Ernesto García García wrote:
> Hi experts,
>
> How would you do this without the more and more indenting cascade of ifs?:
>
> match = my_regex.search(line)
> if match:
> doSomething(line)
> else:
> match = my_regex2.search(line)
> if match:
> doSomething2(line)
> else:
> match = m
IamIan wrote:
> I am confused as to why including 08 or 09 in a sequence (list or
> tuple) causes this error. All other numbers with a leading zero work.
All literals that start with "0" digit are considered as
octal numbers, i.e. only digits "0".."7" are allowed.
See octinteger lexical definitio
Dick Moores wrote:
> I accidentally stumbled across the Turtle Graphics module (turtle.py)
> the other day and have been having some fun with it.
>
> Now I'm wondering if there is a way to build into a script the saving of
> each window just before it is cleared. For example, here are a couple
Rehceb Rotkiv wrote:
> I want to check whether, for example, the element myList[-3] exists. So
> far I did it like this:
>
> index = -3
> if len(myList) >= abs(index):
> print myList[index]
IMHO it is good way.
> Another idea I had was to (ab-?)use the try...except structure:
>
> index =
Dick Moores wrote:
>> Turtle module uses Tk canvas element to draw graphics ('_canvas'
>> attribute). I've written module, that exports canvas graphics to SVG
>> file: http://wmula.republika.pl/proj/canvas2svg/ -- it may be useful
>> for you.
>
> I afraid I'm totally unfamiliar with SVG. Would it
Dick Moores wrote:
> What do I do to see this?
For example Opera 9 and Firefox 1.5+ are able to view SVG files;
there is a free plugin for IrfanView.
w.
--
http://mail.python.org/mailman/listinfo/python-list
Dropkick Punt wrote:
prefixes = [ "the", "this", "that", "da", "d", "is", "are", "r", "you",
"u"]
>
> And I have a string, that I split() into a list.
>
sentence = "what the blazes is this"
sentence = sentence.split()
>
> Now I want to strip the sentence of all words in the
cifically, a general class / interface called "Feature" and then
subclasses that implement functions like isFeaturePresent() in all of
their different and unique ways. I'd love to hear how I can do this in
Python.
Thanks,
Wojciech
--
http://mail.python.org/mailman/listinfo/python-list
Thank you Carl and thank you Jarek. This makes me feel much better --
on to coding, I shall go. :)
Thanks again,
Wojciech
On Oct 4, 11:27 am, Carl Banks <[EMAIL PROTECTED]> wrote:
> On Oct 4, 11:11 am, Wojciech Gryc <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I
Thomas Nelson wrote:
> My code:
>
> class Policy(list):
> def __cmp__(self,other):
> return cmp(self.fitness,other.fitness)
Define method __gt__.
--
http://mail.python.org/mailman/listinfo/python-list
jupiter wrote:
> I have a problem. I have a list which contains strings and numeric.
> What I want is to compare them in loop, ignore string and create
> another list of numeric values.
>
> I tried int() and decimal() but without success.
>
> eq of problem is
>
> #hs=string.split(hs)
> hs =["popo
[EMAIL PROTECTED] wrote:
> Hi, I am using gvim to edit python source files. When I press "*" or
> "#", I would want to search for the attribute name under the cursor
> and not the entire string.
> For example, If I have os.error and pressing * on top of error
> searches for os.error rather than er
uld be grateful for any advice as to
what I'm doing wrong, or why this may be happening.
Thank you,
Wojciech Gryc
--
http://mail.python.org/mailman/listinfo/python-list
;t see the rest of the file, I don't even know how to get
to it to fix the problem... Due to the nature of the data I'm working
with, manual editing is also not an option.
Thanks,
Wojciech
On Dec 20, 3:30 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Dec 21, 6:48 am, Wojciech G
PAolo wrote:
> any comment, suggestion? Is there something not elegant?
Try this:
even = range(10)[0::2]
odd = range(10)[1::2]
--
http://mail.python.org/mailman/listinfo/python-list
manstey wrote:
> in for loops like the following:
>
> word='abcade'
>
> for letter in word:
>print letter
>
>
> Is it possible to get the position of letter for any iteration through
> the loop?
for index, letter in enumerate(word):
print index, letter
--
http://mail.python.org/mailma
Ronny Mandal wrote:
> Assume we have a list l, containing tuples t1,t2...
>
> i.e. l = [(2,3),(3,2),(6,5)]
>
> And now I want to sort l reverse by the second element in the tuple,
> i.e the result should ideally be:
>
> l = [(6,5),(2,3),(3,2)]
>
>
> Any ideas of how to accomplish this?
def cmpfun
"David Hláčik" wrote:
> I have to create stable algorithm for sorting n numbers from interval
> [1,n^2] with time complexity O(n) .
Some kind of radix sort or counting sort. These algo. has O(n) complexity.
w.
--
http://mail.python.org/mailman/listinfo/python-list
"Daniel Fetchinson" wrote:
> Is it a feature that
>
> 1 or 1/0
>
> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale?
See: http://en.wikipedia.org/wiki/Short-circuit_evaluation
--
http://mail.python.org/mailman/listinfo/python-list
2008/5/4, Giampaolo Rodola' <[EMAIL PROTECTED]>:
> For now I've been able to determine the family by using:
>
> # self.socket = a connected socket.socket instance
> ip, port = self.socket.getsockname()[0:2]
> af = socket.getaddrinfo(ip, port)[0][0]
>
> ...but I'd like to know if some other sol
2008/5/5, globalrev <[EMAIL PROTECTED]>:
> class Foo(object):
> def Hello(self):
> print "hi"
>
> object is purple, ie some sort of reserved word.
>
> why is self in black(ie a normal word) when it has special powers.
> replacing it with sel for example will cause an erro
2008/5/5, globalrev <[EMAIL PROTECTED]>:
> pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/example1.mp3')
Are you sure that:
os.path.exists('C:/Python25/myPrograms/pygameProgs/example1.mp3') == True?
Check it with python.
--
Regards,
Wojtek Walczak
http://www.stud.umk.pl/~wojtekwa
2008/5/6, Yuan HOng <[EMAIL PROTECTED]>:
> It seems decimal object will always be larger than float in
> comparasion, which goes against common sense:
>
> >>> from decimal import Decimal
> >>> a = Decimal('0.5')
> >>> a > 9
> False
> >>> a > 9.0
> True
>
> It seems to me that rathe
2008/5/6, Wojciech Walczak <[EMAIL PROTECTED]>:
> a > 9.0 returns True because NotImplemented > 9.0 returns True.
> a < 9.0 returns False because NotImplemented < 9.0 returns False.
Sorry, it should rather be:
Decimal('0.5') > 9
2008/5/6, Banibrata Dutta <[EMAIL PROTECTED]>:
> > Use /usr/bin/env. If env is not in /usr/bin, put a link to it there.
>
> So why not put symlink to Python over there on all machines, if we can
> put one (or env itself) there ?
To avoid linking all the rest of interpreters like perl, ruby, lu
2008/5/6, Ben Finney <[EMAIL PROTECTED]>:
> > > So why not put symlink to Python over there on all machines, if
> > > we can put one (or env itself) there ?
> > To avoid linking all the rest of interpreters like perl, ruby, lua
> > and dozens of others.
> The argument was being made from "thou
2008/5/6, Anton Slesarev <[EMAIL PROTECTED]>:
> But I have some problem with writing performance grep analog.
[...]
> Python code 3-4 times slower on windows. And as I remember on linux
> the same situation...
>
> Buffering in open even increase time.
>
> Is it possible to increase file readin
VanceE wrote:
> for x in []:
> assert type(x) == type(())
>
> I expected an AssertionError but get no errors at all.
> Any explaination?
[] is an empty sequence, so your loop executes exactly 0 times. :)
for x in [None]:
assert ...
w.
--
http://mail.python.org/mailman/listinfo/py
Klaus Neuner wrote:
> > handlers = {
> > ".txt" : handle_txt,
> > ".py" : handle_py,
> > # etc
> > }
> >
>
> That is exactly what I would like to avoid: Having to map the function
> 'handle_txt' to '.txt'. Firstly, because I don't want to repeat
> anything and secondly, because I
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
How to know if connection is active after telnetlib.Telnet.open(host,port)?
--
http://mail.python.org/mailman/listinfo/python-list
> If open() doesn't throw an exception then you should have a connection you can
> start reading/writing with. Unless you have some special meaning for
> 'active'?
>
> I'm just basing this on reading telnetlib.py.
>
> Eddie
Well, in fact what I meant is: I won't to check wether established
conn
69 matches
Mail list logo