Am Donnerstag, 25. März 2010 13:31:07 schrieb Hugo Arts:
> On Thu, Mar 25, 2010 at 12:24 PM, Ray Parrish wrote:
> > As you can see, it is tossing a key error on the same ip address that was
> > used in the interactive code successfully,
> >
> > I can not figure out what to change to make the scrip
Am Mittwoch, 3. März 2010 21:41:34 schrieb Dave Angel:
> John wrote:
> > Hi,
> >
> > I just read a few pages of tutorial on list comprehenion and generator
> > expression. From what I gather the difference is "[ ]" and "( )" at the
> > ends, better memory usage and the something the tutorial label
> > Why people use proprietary python ?
Well, AFAIK I know, all more or less popular non-Ansi-C implementations of
Python are free. (Jython is, IronPython too, although I've never checked in
detail, stackless is, PyPy is too, ...)
> > It's better to spent energy to participate with the core deve
Am Samstag, 13. Februar 2010 16:56:08 schrieb patrice laporte:
> Hi,
>
> Being in an exeption of my own, I want to print the name of the caller, and
> I'm looking for a way to have it.
>
> I've found a lot of recipe all of them using what seems to be, according to
> me, a not so good trick : all
Am Donnerstag, 11. Februar 2010 15:42:31 schrieb Harya Dananjaya:
> On 11/02/10 17:47, Timo wrote:
> > I use py2exe to compile my Python/PyGTK application.
> > I build it on my Windows XP machine and it works on Windows 2000 to
> > Windows 7 without installing anything else (like Python).
> >
> > T
Am Donnerstag, 11. Februar 2010 12:44:48 schrieb Harya Dananjaya:
> On 11/02/10 17:34, Alan Gauld wrote:
> > What would you do with Java? It too is cross platform but requires a
> > JVM to be installed on every platform. Python is similar.
>
> OK, but python need 3rd praties library, and may be th
The modes for updating files are + suffixed.
r+ Open for reading and writing. The stream is positioned at the
beginning of the file.
w+ Open for reading and writing. The file is created if it does
not exist, otherwise it is trun‐
cated. The stream is p
Am Donnerstag, 21. Januar 2010 18:48:36 schrieb invincible patriot:
> hi
> I am a student and i need soe help regarding my assignmentif some one can
> help me il be glad.
You do realize that assignments are things to be done by yourself?
This is a mailing list, so just post your questions, but d
Some things:
1) It's Python, not Phython.
2) Slightly shorter solution to your problem:
import random
input = range(53)
random.shuffle(input)
print input
3) The important part here is that reimplementing something that is in
the standard library does not make sense usually.
4) A more sensible
Am Mon, 9 Feb 2009 12:05:33 -0800
schrieb Moos Heintzen :
> Hello all,
>
> I was looking at this:
> http://www.debian.org/doc/manuals/reference/ch-program.en.html#s-python
>
> I have a question about the line of code that uses split()
>
> With the python version, the line below only works if th
Am Tue, 20 Jan 2009 09:33:40 -0600
schrieb "Paul McGuire" :
No need for a defaultdict, all dicts have a setdefault method that
works fine for this assign an empty dict/list as starting point problem:
wordlendict = {}
for w in words:
wordlendict.setdefault(len(w), []).append(w)
try:
minle
Am Wed, 21 Jan 2009 05:40:00 -0800
schrieb jadrifter :
> >>>a = '1234 5678 1 233 476'
> >>>a.split()
> ['1234', '5678', '1', '233', '476']
[int(x) for x in a.split()] # [1234, 5678, 1, 233, 476]
Andreas
___
Tutor maillist - Tutor@python.org
http://mai
Am Mon, 22 Dec 2008 07:18:41 -0800
schrieb johnf :
> I've been in the programming business for over 20 years and I have
> never had a need for a parser. But recently I have need to convert
> code from one language to a my new language python. What a better
> way to learn the new language python
Am Fri, 19 Dec 2008 15:57:49 +
schrieb Tim Golden :
> Eduardo Vieira wrote:
> > Hello, this is my first post in this list and I'm not a programmer,
> > but am enjoying learning python.
> > I'm trying to make a script to add worksheets to excel files:
> > I managed to implement this code:
> >
Am Fri, 19 Dec 2008 09:01:24 -0500
schrieb "Emad Nawfal (عماد نوفل)" :
You are not supposed to compile the main script.
pyc files are automatically generated when you import the py file (but
not execute it), if you are allowed to write them beside the py file.
When a pyc file exists, and it's ne
Am Wed, 17 Dec 2008 11:17:14 -0500
schrieb "Kent Johnson" :
> On Wed, Dec 17, 2008 at 10:20 AM, ppaarrkk
> wrote:
> >
> > I can do this :
> >
> sys.path.append ( 'C:\dump1' )
>
> Note you should use raw strings r'C:\dump1' or double backslash
> 'C:\\dump1' because the \ is a string escape c
Am Mon, 15 Dec 2008 12:43:46 -0800
schrieb johnf :
> On Monday 15 December 2008 11:31:12 am Andreas Kostyrka wrote:
> > Am Mon, 15 Dec 2008 10:18:28 -0800
> >
> > schrieb johnf :
> > > Hi,
> > > I have a string that I need to extract just the sql
>
Am Mon, 15 Dec 2008 10:18:28 -0800
schrieb johnf :
> Hi,
> I have a string that I need to extract just the sql
> statement. The following is the string
> \000\000\000\000\000\000\000\000.\000\000\000\\000\000\000
> \000$\000\000\000\000\000(\000\000\000\000X\000\000\000\000\
On Sat, Dec 13, 2008 at 08:03:10AM +, Lie Ryan wrote:
> On Sat, 13 Dec 2008 02:59:34 +0100, Andreas Kostyrka wrote:
>
> > On Fri, Dec 12, 2008 at 06:06:35PM -0500, Shrutarshi Basu wrote:
> >> I have a list containing strings like :
> >>
> >>
On Fri, Dec 12, 2008 at 06:06:35PM -0500, Shrutarshi Basu wrote:
> I have a list containing strings like :
>
> func1[]
> func2[1,2]
> func3[blah]
>
> I want to turn them into method calls (with numeric or string
> arguments) on a supplied object. I'm trying to figure out the best way
> to do this
On Wednesday 23 July 2008 22:04:57 Alan Gauld wrote:
> ""Simón A. Ruiz"" <[EMAIL PROTECTED]> wrote
>
> > If what you expected was something like:
> >
> > Hello World!
> > Here are ten numbers from 0 to 9
> > 0 1 2 3 4 5 6 7 8 9 Goodbye World!
> >
> > Then you want that final print statement to not
On Sunday 08 June 2008 17:13:21 Dotan Cohen wrote:
> 2008/6/8 Kent Johnson <[EMAIL PROTECTED]>:
> > On Sun, Jun 8, 2008 at 6:46 AM, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> >> I am moving a website from php to python gradually. The first step is
> >> replacing the page headers and footers.
> >
> >
On Friday 06 June 2008 18:19:23 you wrote:
> On Thu, June 5, 2008 9:39 am, Andreas Kostyrka wrote:
> > On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote:
> >> You listed __init__ and I'm not sure I know what you mean.
> >
> > Well, __init__ can assign
On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote:
>
> You listed __init__ and I'm not sure I know what you mean.
>
Well, __init__ can assign attributes to the instance that are callable.
Andreas
signature.asc
Description: This is a digitally signed message part.
___
On Thursday 05 June 2008 12:31:56 you wrote:
> On Jun 5, 2008, at 6:06 PM, Andreas Kostyrka wrote:
> > well, don't return a string :-P
> >
> > class CallableString(str):
> > def __call__(self, *args, **kw):
> > return self
> >
> > And now
On Wednesday 04 June 2008 18:18:04 you wrote:
> > Well, let's start the ball rolling then.
> >
> > __getattribute__
> > __getattr__
> > Metaclasses
> > decorators
> > properties
> > __init__
>
> Okay, I'll bite. I asked here a week or two ago about creating a
> custom dummy object that returns a bl
Simple (untested in the mailer typed):
class A:
def __getattr__(self, key):
if key.startswith("user"):
def func():
return key[4:]
return func
raise AttributeError
assert A().userabc() == "abc"
Something like that?
On Wednesd
On Wednesday 04 June 2008 07:41:49 Marilyn Davis wrote:
> On Tue, June 3, 2008 10:16 pm, Alan Gauld wrote:
> > "Laureano Arcanio" <[EMAIL PROTECTED]> wrote
> >
> >> Is there any way to intercept calls to methods ? like the
> >> __setattribute__
> >> medthod does ?
> >
> > There are several variatio
On Tuesday 03 June 2008 15:18:39 Michael yaV wrote:
> The green horn that I am, last week I started to go through the "How
> to Think Like a Computer Scientist" tutorial. I have gotten to Chapter
> 3 --Functions' 3.8 Exercises. I think I have the 1st exercise correct
> but I'm really not sure. Is t
Am Montag, den 12.05.2008, 23:31 -0700 schrieb Mark Tolonen:
> "tuyun" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi
> > I have a library written in C, I want to make a python binding for it.
> > But I dont know how to get started.
> > Is there any guide or document?
> > Is
Hmmm, the power function has basically two definitions:
a ** n
for integer n, pow is defined for all a in R.
for real n, pow is defined only for non-negative a.
If you think how a**x is derived (as a generalization from a**(p/q)),
that makes sense.
Basically, a ** (p/q), p > 0, q > 0, gcd(p, q)
eeck.
Not that I advocate parsing files by line, but if you need to do it:
lines = list(file)[16:]
or
lines_iter = iter(file)
zip(lines_iter, xrange(16))
for line in lines_iter:
Andreas
Am Montag, den 21.04.2008, 14:42 + schrieb linuxian iandsd:
> Another horrid solution
>
> #!
If you have a correct XML document. In practice this is rather a big IF.
Andreas
Am Montag, den 21.04.2008, 10:35 -0700 schrieb Jeff Younker:
> On Apr 21, 2008, at 6:40 AM, Stephen Nelson-Smith wrote:
>
> > On 4/21/08, Andreas Kostyrka <[EMAIL PROTECTED]> wrote:
> &
, den 21.04.2008, 14:40 +0100 schrieb Stephen Nelson-Smith:
> On 4/21/08, Andreas Kostyrka <[EMAIL PROTECTED]> wrote:
> > As usual there are a number of ways.
> >
> > But I basically see two steps here:
> >
> > 1.) capture all dt elements. If you want
As usual there are a number of ways.
But I basically see two steps here:
1.) capture all dt elements. If you want to stick with the standard
library, htmllib would be the module. Else you can use e.g.
BeautifulSoup or something comparable.
2.) Check all dt contents either via regex, or with a .s
line.strip()
for line in file: => line will contain '\n' at the end of the string.
Andreas
Am Montag, den 14.04.2008, 00:08 -0700 schrieb Que Prime:
>
> This is what I came up with after writing it out and reading the
> corresponding functions. I feel I'm close but something is still
> awry.
>
Am Sonntag, den 13.04.2008, 23:31 +0100 schrieb Alan Gauld:
> "Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
>
> > Your last paragraph is the gist of my note ie. it's the
> > documentation, documentation, documentation.
>
> I agree it can be very variable in quality.
> One of the problems of Open
To summerize, it's Python 2.5.2, gutted to remove any chance of storing
anything local. Plus you can define patterns that get mapped to Python
CGI scripts. Included are also a number of APIs e.g. for data storage
(that look at first glance visually similiar to Django models), an API
to authenticate
Python 2.4.5 (#2, Mar 12 2008, 00:15:51)
[GCC 4.2.3 (Debian 4.2.3-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
... exec("raise ValueError")
... except:
... print "raised some exception"
... import sys
... print sys.exc_info()
...
ra
ited[url]:
> except KeyError:
> #This means the URL hasn't been visited
>
> that's probably the easiest way to compare dict values. A possible
> good idea, if you were going that route (reading each file) is to
> create a dir for each 1st char in the url (aft
Am Montag, den 07.04.2008, 00:32 -0500 schrieb Luke Paireepinart:
> devj wrote:
> > Hi,
> > I am making a web crawler using Python.To avoid dupliacy of urls,i have to
> > maintain lists of downloaded urls and to-be-downloaded urls ,of which the
> > latter grows exponentially,resulting in a MemoryE
Eric and SPE are also nice.
The good thing here is that the majority of IDEs for Python are free.
Andreas
Am Donnerstag, den 03.04.2008, 16:57 +0100 schrieb Alan Gauld:
> "Jeffrey Dates" <[EMAIL PROTECTED]> wrote
>
> > So as I'm starting to get into writing some scripts, I'm looking for
> > rec
Well, the source is easy enough to read.
Although I wouldn't call Twisted a complication. If all you want is your
async server Hello World example, asyncore is fine. If you intend to use
the stuff for serious things, one usually starts to reinvent/reimplement
Twisted anyway.
Andreas
Am Mittwoch,
There are many as you said yourself. Recommendation: sqlalchemy.org
Andreas
Am Mittwoch, den 02.04.2008, 16:51 +0530 schrieb hiren kumar:
> Hi,
>
> I am very much new to Python and it's available framework.
>
> When I search the over net about Python ORM, I found there are so many
> ORMs availa
Hint: When you want help with your homework, you should first try to
program something. Pasting the requirements to this mailing list will
not help you. Homeworks are there so that YOU learn something. Not that
you can prove that you are capable to find someone that does it for you.
Andreas
Am Fr
strong points for using Python
>
>
> On Tue, Mar 25, 2008 at 2:46 AM, Andreas Kostyrka <[EMAIL PROTECTED]> wrote:
> > Well, not exactly. Mixing Python with C/C++ extends the "coverage" that
> > you can do with Python.
> >
> > Andreas
> >
Well, not exactly. Mixing Python with C/C++ extends the "coverage" that
you can do with Python.
Andreas
Am Montag, den 24.03.2008, 23:39 -0700 schrieb Tony Cappellini:
> Another alternative is Weave
> http://www.scipy.org/Weave
>
> But mixing C/C++ with Python sort of defeats the reasons for us
A classical example is a class that can be constructed from different
values.
Ok, let's implement a special integer class:
class MyOwnInteger(object):
def __init__(self, value):
self.value = value
Now, let's say we want to add the possibility to create MyOwnInteger
instances from str
One usual usage for classmethods are "alternate" constructors.
Andreas
Am Sonntag, den 23.03.2008, 10:49 -0700 schrieb maser:
> Thanks, Andreas. Why do we need to use classmethod/
> staticmethod and where do we need to use them ?
>
> thanks
> iyer
>
> --- And
Am Mittwoch, den 19.03.2008, 10:36 -0300 schrieb Ricardo Aráoz:
> Luciano Ramalho wrote:
> > Nowadays the best practice for invoking a method from all superclasses
> > (yes, multiple inheritance) is this:
> >
> > class SubClass(BaseClass):
> > def __init__(self, t, *args, **kw):
> > s
Well, it's classmethod/staticmethod in truth, @ is the decorator
operator:
def testdec(func):
return {"funcobj": func}
class Abc(object):
@testdec
def method():
pass
assert isinstance(Abc.method, dict)
Basically as you can see above, @X before a function definition takes
the
Well, there are basically two ways to go at it.
If you want it at module level, you need to generate the functions:
sensor = {'sens1': 200, 'sens2': 300}
for key in sensor.keys():
def helper(keytofetch=key):
return sensor[keytofetch]
globals()[key] = helper
print sens1()
pri
Beside casting it with str(), you can also use a format string:
assert "%d" % 10 == "10"
assert "%5d" % 10 == " 10"
assert "%05d" % 10 == "00010"
In practice % supports a superset of what printf in C provides.
Andreas
Am Freitag, den 21.03.2008, 17:05 -0700 schrieb elis aeris:
> how do I conv
somestring = "ABC"
somestring2 = somestring + "D"
somestring2 += "EF"
assert somestring2 == "ABCDEF"
assert somestring == "ABC"
assert id(somestring) != id(somestring2)
Basically, strings are immutable. If you need to append something to a
string, you need to construct a new string object with th
Empty?
array = []
If you want to assign 10 "None", that would be:
array = [None] * 10
Andreas
Am Freitag, den 21.03.2008, 17:03 -0700 schrieb elis aeris:
> how do I create an empy int array of 10?
> ___
> Tutor maillist - Tutor@python.org
> http://
It does not return them at once.
It returns them piece by piece:
[EMAIL PROTECTED]:/tmp> cat mro.py
class A(object):
v=lambda self: "A"
class B(object):
v=lambda self: "B"
class C(B,A):
v=lambda self: "C"
print C.__mro__
c=C()
print c.v()
print super(C, c).v()
print super(B, c).v()
Am Freitag, den 21.03.2008, 21:48 -0500 schrieb tiger12506:
Actually, super returns all base classes, all in it's own time.
Basically, every class has a member __mro__, that contains a
consistently ordered list of classes.
super needs the class from where it is being called to locate the right
If you need to rewrite Python code for performance, I'd recommend using
Pyrex/Cython. (www.cython.org).
It let's you get away with small changes to your code as a starter
(Cython is relative compatible syntax-wise with Python), and you can add
"C type annotations" as needed. (And no, C++ is not co
Assuming that len(b) > len(a):
>>> zip(itertools.cycle(a), b)
[(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f'), (1, 'g'), (2,
'h'), (3, 'i'), (4, 'j')]
Andreas
Am Dienstag, den 18.03.2008, 16:23 +0100 schrieb PyProg PyProg:
> Hello,
>
> I have a little problem, I have two lists:
>
assert 4**0.5 == 2
More generally: nth root of x: x ** (1.0/n)
Or even more generally, take the 3rd root of the square of x:
x ** (2.0/3.0)
And when we are already extending the scope of the mailing list to math
basics:
1.0/(x**2) == x**-2
(negating the power gives the inverse.)
Andreas
Am
Am Mittwoch, den 12.03.2008, 09:39 +0100 schrieb Meftah Tayeb:
> hi my friend,
> i have active python installed and the python-Win is Ready
> but i have a Very Small problem:
> i am blind, and i am using a Screen reader
> this screen reader use the Microsoft Active Accessibiliti (MSAA) to find
>
Alternatively, follow the recipe at
http://www.tech-recipes.com/solaris_networking_tips785.html
You can either just copy&paste the script and use that with popen, or
you can reimplement it mostly in Python, calling the seperate programs.
The basica gist of this seems to be, figure out your IP add
What you probably want is to pass:
writer(None, "field1", "field2")
Andreas
Am Montag, den 10.03.2008, 16:28 +0100 schrieb [EMAIL PROTECTED]:
> And I thought I might get away without using dicts...
>
> Thanks, Greg
>
>
>
> Greg Graham schrieb:
> > Paul,
> >
> > Python does not allow mixing
As I thought, it does not fail silently.
You need something like:
if not parser.has_section("feeds"):
parser.add_section("feeds")
Andreas
Am Samstag, den 08.03.2008, 16:46 + schrieb dave selby:
> Hi All,
>
> I am using the ConfigParser module, I can 'get' from a config file
> fine, whe
Am Freitag, den 07.03.2008, 21:13 + schrieb Alan Gauld:
> Yes but thats not the bit that takes time in my experience its
> trying to understand the problem. What exactly am I trying to
> do here? Is it a suimulation exercise, a database problem?
> A real-time or networking issue? Should my sol
There are basically a number of things you might want:
1.) sys.argv[0]
2.) __main__.__file__
3.) sys._getframe
The first two will tell which script is the main program. The last one
will tell you which function has called you.
But as Kent has pointed out, this is rarely a good idea. Actually, it
Yes, the problem is, that these guys are anyway forced to have
Python/Erlang developers on board, because of external opensource
components they need to maintain.
Am Donnerstag, den 06.03.2008, 23:54 + schrieb Alan Gauld:
> Actually I'm with the lead here.
>
> The cost of developing a new fea
Am Donnerstag, den 06.03.2008, 08:35 -0500 schrieb Kent Johnson:
> C++ is extremely complex. The good side of this is it gives you
> tremendous control - final, const, pass by reference or value, memory
> allocation, etc, etc. The bad side is that it is a lot to think about -
> should this para
t really need that much a const so i
> wont do anything like that to have a const like data. I am very used
> to java and c++, thats why i always used acess modifier, but i think i
> can live without it now i know that it dont exist in python :P.
>
>
>
> On Thu, Mar 6, 2008 a
The answer is slightly more complex.
1.) objects are either mutable or immutable. E.g. tuples and strings are
per definition immutable and "constant". Lists and dictionaries are an
example of the mutable kind.
2.) "variables", "instance members" are all only references to objects.
Examples:
# l
Don't think so. Do you have any cmdline tool to update the meta data?
Alternativly you can naturally embed Win32 components and control them
with Python, but I'm not a Windows guy.
Andreas
Am Dienstag, den 04.03.2008, 14:10 -0800 schrieb Allen Fowler:
> Hello,
>
> I have several hundred WMV vi
What you probably want is:
[elem_list[2] for elem_list in List]
If you are not sure that the list have at least three elements, you can
use something like this:
[(elem_list + [None, None, None])[2] for elem_list in List]
Which will use None as a default value.
Andreas
Am Dienstag, den 04.03.2
Well, this assumes that all named attributes do exist. If not, you need
to replace x.attr with getattr(x, "attr", defaultvalue) ;)
l.sort(key=lambda x: (x.content_type, x.submit_date))
Now, you can construct a sorted list "t":
t = []
for key, item_iterator in itertools.groupby(l, key=lambda x:
Well, actually, ssh can also protect private keys with a cryptographic
pass phrase. But this is often not what is wanted as it implies that the
user needs to provide the pass phrase every time it is used. (Well,
that's not the complete truth, man ssh-agent, but that's completely
different thing
And if it's a string constant, in many cases running strings (Unix
program) on the pyc file will reveal it too.
All this basically turns down to the problem, that it's hard to embed an
encryption key in a program, so that it's not possible to extract it.
Notice the the current crop of HDDVD/Blu
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Perhaps even nicer:
[key for key, evtime in eventData.iteritems() if evtime < time.time()]
This way the dictionary iterates over key, value tuples.
Andreas
Tiger12506 wrote:
| I may sound like a know-it-all, but dictionaries *are* iterators.
|
| [a
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Try:
for item in stuff:
os.system(item[0])
print item[1]
Alternativly:
for cmd, msg in stuff:
os.system(cmd)
print msg
Andreas
James wrote:
> All,
>
> I have a dumb question...hopefully someone can shed some light on the
> diffe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Well, chmod 0700 is usually not want you want:
a) 0700 gives only read/write/execute rights to the user. Technically
for historical reason permissions can be written as an octal number,
with the first digit being optional, encoding stuff like setuid/s
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Eric Brunson wrote:
> On Sat, July 28, 2007 4:01 am, Thorsten Kampe wrote:
>> * Kent Johnson (Fri, 27 Jul 2007 08:06:33 -0400)
>>
>>> Barton David wrote:
>>>
*sigh* I'm really going off Python.
>>> In what way is it Python's fault that the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Barton David wrote:
> Eric Brunson wrote:
>> You seem like a smart guy that's having a bad day, so I'm cutting you
>> slack.
>
> Thanks Eric. Yes I did indeed have a bad day (and it got much much worse),
> and this is most definitely a case of a ba
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Alan Gauld wrote:
> "Andreas Kostyrka" <[EMAIL PROTECTED]> wrote
>
>> was, that the only way to have more math courses would be to study
>> something with mathematics in the title *g*)
>
> Thats true o
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Alan Gauld wrote:
> "Tiger12506" <[EMAIL PROTECTED]> wrote
>
>> Some people need degrees, most people don't. It all depends on what
>> they are
>> capable of understanding.
>
> It also depends what they are doing.
> Most programmers don't build c
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Barton David wrote:
> Sadly I can't think of a plan B, hence the frustration! Python, as far
> as I know, is as good as it gets. And I don't have the courage or the
> capability to improve it myself.
>
> So all I can really do is clasp my hands toge
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Barton David wrote:
> I mean no offense and lay no blame. It's simply that I feel like I've
> been led up a nice gentle beach and suddenly I'm dodging boulders at the
> bottom of a cliff.
>
> I've learned to program with Python (and can hardly conce
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
That's in the nature of the underlying database library used for the
shelve. Most dbm implemention on Unix are using a sparse file that is
used as hashmap. E.g. compare ls -l versus du of the database file.
Now if this is the case, there is no way (wi
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Alternatively, I prefer something nicer:
import optparse
p = optparse.OptionParser(usage="%prog [options]")
p.add_option("--list1", action="store_const", const=["blue", "red",
"green"], dest="worklist", help="use the first setting")
p.add_option("--li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
sys._getframe.
Andreas
jay wrote:
> Hello all,
>
> If I import a module, which has a bunch of simple functions in it, is
> there an easy way to find the direct caller from inside one of those
> functions? I'm looking to know which script has impor
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
mkarg is quite useful, from time to time.
Andreas
Luke Paireepinart wrote:
> Justin Cardinal wrote:
>> I'm trying to write a program that will list all subversion repository
>> directories, then issue a command using each directory as an argument,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
DBAPI is an interface standard describing what you can expect in a
database access module, like psycopg.
Andreas
z machinez wrote:
> Hi All,
>
> I am just starting out with Python and was hoping someone could point me
> in the direction of reading
Well he could implement the indexing into his program and check mtimes to
decide if he needs to reindex.
But yes, as long the file fits into memory, readlines (or
list(file("quotes,txt")) makes more sense.
Andreas
-- Ursprüngl. Mitteil. --
Betreff:Re: [Tutor] reading random line from a
I haven't done anything like that as I don't use Windows for anything serious.
But I see basically no problem, as at least some of the packages you've
mentioned are portable to marginal OSes like Windows *g*
So my tip would be, start implementing, I personally would probably stick to
conch for
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Well, philosophically every object "name" is a pointer to a PyObject on
C level. The only difference is, that you cannot do anything but assign
these pointers (no pointer arithmetic) and memory is managed automatically.
If you want to know what happen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Simple, defining __hash__ on a class allows you to supply a hash value
for instances of your class.
[EMAIL PROTECTED]:~> cat /tmp/hash.py
class X:
def __hash__(self):
print "HASH CALLED"
return 123
print hash(X())
[EMAIL PROTECTED
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
You forgot the uncertainty of 1000% :)
Actually, Python is relativly easy to learn, but I've known people that
were trained by the Arbeitsamt (government employment office), which
never, even after months could predict the output of programs like:
fo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Well, first that sounds somehow like a homework assignment, so only some
hints:
a) work out the underlying math. Consider all special edge cases.
b) I'm not completely sure what you need, but a feeling in the stomach
tells me that you might need the a
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Consider using something like:
try:
start, end = int(start), int(end)
except ValueError:
print "oops it was not a number."
Andreas
Terry wrote:
> Hi!
>
> I am running Python 2.5, and I have an IF statement in the below program
> that does n
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Please notice the link http://mail.python.org/mailman/listinfo/tutor in
the footer of every mailing list mail. It's not really very nice to
shoot into a big room with many persons in it "carry me out of the
room". Most people prefer to walk out of the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Well, take a look at the socket module and nonblocking mode.
But truly, it's not a good "first" program, not for Python, not for C.
Andreas
max . wrote:
> hello i am looking into writing a simple python port scanner but i cant
> find
> any good tuto
Tip: consult the documentation of the struct module.
Andreas
-- Ursprüngl. Mitteil. --
Betreff:[Tutor] sockets
Von:"Linus Nordström" <[EMAIL PROTECTED]>
Datum: 17.06.2007 22:47
Hello
I'm trying to rewrite a chat-program i did in school this spring in
python, the school progr
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Well, Python is not Java :)
Unqualified names reference always only objects defined in the local
module by default.
If you want to use unqualified names, you could do something like that:
from AddrBookEntry import AddrBookEntry
or
import AddrBookE
1 - 100 of 195 matches
Mail list logo