Re: A Moronicity of Guido van Rossum

2005-09-30 Thread axel
In comp.lang.perl.misc Kalle Anke <[EMAIL PROTECTED]> wrote:
> On Thu, 29 Sep 2005 19:44:28 +0200, Matt wrote
> (in article <[EMAIL PROTECTED]>):
 
>> OK... your post seems to indicate a belief that everyone else is
>> somehow incompetent. Sounds a bit like the "I am sane, it is everyone
>> else who is crazy" concept. Can you suggest a technology or
>> technologist who, in your expert opinion, has gotten it right?
 
> He has posted similar posts about other things to at least one other mailing 
> list, the tone and arguments of these post were exactly the same.

I wonder if his postings are related to the phases of the moon? It
might explain a lot.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-10 Thread axel
In comp.lang.perl.misc John Bokma <[EMAIL PROTECTED]> wrote:
> Roedy Green <[EMAIL PROTECTED]> wrote:
 
>> On 8 Oct 2005 23:39:27 GMT, John Bokma <[EMAIL PROTECTED]> wrote or
>> quoted :

>>>Yeah, yeah, and 640K is enough for everybody. Same song, different tune.

>> For how long.  Surely attachments are a stop gap. Can you imagine
>> people sharing images that way 100 years from now?
 
> No, but I agree with you :-) I am not using HTML myself in email, but I 
> will when it makes things easier.
 
>> Why should we wait for the future?  The problems blocking easy to use
>> photo sharing are not technological but social.
 
> Yup, agreed. Like I already wrote, if I route all HTML email to /dev/null 
> I'll lose some customers, and some friends :-)

What I find is that when I see emails which are obviously spam, I
simply do not read them and delete them immediately. But then I
use Pine rather than a web browser... and while some forms of HTML
may be rendered, nothing is automatically pulled down.

Axel

 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-10 Thread axel
In comp.lang.perl.misc Tim Tyler <[EMAIL PROTECTED]> wrote:
> In comp.lang.java.programmer Steven D'Aprano <[EMAIL PROTECTED]> wrote or 
> quoted:
>> Only if your photos are so obscure and confusing that they need captions.
 
>> "Here's Johnny with the dog. Here is Johnny with the dog again. This one
>> is Johnny on his own. Here is the dog. Oh look, it is Johnny with the dog
>> again -- that's the dog on the left, in case it isn't clear. Just for a
>> change, this is Johnny wearing a hat. It is blue with a feather in it,
>> in case you couldn't tell from, oh I don't know, looking at the actual
>> picture."
 
> What have you got against captions?
 
> Giving photos captions is a *very* common practice.

Why not just put them on a web page? It is then possible to include
thumbnails so the recipient can chose to see which ones he cares to
look at in detail.

It also allows the web address to be sent to several people
without wasting bandwith.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-11 Thread axel
In comp.lang.perl.misc Roedy Green <[EMAIL PROTECTED]> wrote:
>>HTML is a problem on *other* peoples crappy software as well. It
>>wasn't designed to carry code content, but has been hacked up to do
>>that.
 
> It seems to me it goes without saying that you cannot trust code from
> strangers, especially anonymous strangers.  You simply don't run code
> sent in email except from highly trusted individuals.  If you do, that
> is YOUR fault for being such a silly ass not the mail system's ability
> to deliver code.  It is as stupid as running code that came as an
> attachment.
 
> One of the ideas I play with in my essay  is that you could insist
> your correspondents have digital id certificate signed by Thawte or
> other CA attesting to their identity, thus giving you legal recourse
> against them if they send you spam, Trojans etc.
 
> This would slow them down with requests for permission to send. they
> could send only one per certificate.  The  cost and hassle of getting
> the certificate could deter tem, and uniquely identify them for
> blocking and public black lists.

Plus being a total pain for legitimate correspondents and also expensive.

I don't know how much spam other people receive but on one account I
hardly receive any as I reserve it for friends and business. On another
I had about 40 spam messages which took all of ten seconds to delete.
Hardly a serious matter.

Axel

> 
> 
> 
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-13 Thread axel
In comp.lang.perl.misc Roedy Green <[EMAIL PROTECTED]> wrote:
> On Thu, 13 Oct 2005 01:17:45 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote
 
>>No, that's what makes email a vector for infection. What makes using
>>the address book - for whatever purpose - possible for viruses is
>>having an API that allows arbitrary code to access it. But you have to
>>have that API - your customers are going to insist that they be able
>>to use their address book from third party applications.
 
> An automated change of address is possible today. It would be LESS
> easy to pull off under the scheme I proposed that requires digital
> signatures.

How? I keep my address book on my Palm as I send mail from different
computers? I suspect many other people do as well.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-16 Thread axel
In comp.lang.perl.misc Matt Garrish <[EMAIL PROTECTED]> wrote:

>> Part of their behavior really escape me.  The whole thing about browser
>> wars confuses me.  Web browsers represent a zero billion dollar a year
>> market.  Why would you risk anything to own it?
 
> It may not be worth loads of money in-and-of itself now (don't forget 
> Netscape wasn't always free, though), but if you control how people view the 
> Internet you can make a lot of money in other ways, especially if you build 
> your browser into your operating system and warp standards so that people 
> who design sites take advantage of the proprietary features. Eventually the 
> hope is that your OS and browser will become the only means of accessing the 
> internet. And if your OS and browser are the only way to access the 
> Internet, who in their right mind would use another system?

There was a time in the early-mid 1990s that Microsoft was making noises
about setting up a 'commercial Internet' through which they hoped
to control all online trading (with a percentage of each transaction
going to themselves of course). I forget the exact details but it
seemed a very real suggestion at the time.

Axel
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread axel
In comp.lang.perl.misc Roedy Green <[EMAIL PROTECTED]> wrote:
> On Wed, 19 Oct 2005 03:15:03 -0700, "David Schwartz"
> <[EMAIL PROTECTED]> wrote or quoted :
 
>>Did I say their obligation was to secure their shareholders as much 
>>profit as possible? I said their obligation was to their shareholders.
 
> You are literally saying people work for a company have an obligation
> to the shareholders. That is too obvious to be bothered with
> announcing. The employees take the shareholder's money, so obviously
> they have an obligation to produce something in return.  When I read
> your words, I think you really mean this is the prime or sole
> obligation of an employee.  I disagree with that. There are many
> loyalties that compete.

Employees have *no* obligations towards the shareholders of a company.
They are not employed or paid by the shareholders, they are employed
by the company itself which is a separate legal entity.

It is a different matter for the board of directors of a company.

Axel
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-23 Thread axel
In comp.lang.perl.misc David Schwartz <[EMAIL PROTECTED]> wrote:
> "Mike Meyer" <[EMAIL PROTECTED]> wrote in message 
 
>> Sorry, but nobody but the government actually owns property. In most
>> places, you can't make non-trivial changes to "your" property without
>> permission from the government. They even charge you rent on "your"
>> property, only they call it "property tax".
 
>I see you are a totalitarianist or perhaps a communist. If you want to 
> live in America and discuss things that are relevent to America, let me 
> know.

Why would you say that - Mike Meyer made a point to which you have
obviously no answer. Or do you deny that his comments on this matter
of property are true?

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-24 Thread axel
In comp.lang.perl.misc David Schwartz <[EMAIL PROTECTED]> wrote:
 
> <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
 
>> In comp.lang.perl.misc David Schwartz <[EMAIL PROTECTED]> wrote:
>>> "Mike Meyer" <[EMAIL PROTECTED]> wrote in message
 
>>>> Sorry, but nobody but the government actually owns property. In most
>>>> places, you can't make non-trivial changes to "your" property without
>>>> permission from the government. They even charge you rent on "your"
>>>> property, only they call it "property tax".
 
>>>I see you are a totalitarianist or perhaps a communist. If you want to
>>> live in America and discuss things that are relevent to America, let me
>>> know.
 
>> Why would you say that - Mike Meyer made a point to which you have
>> obviously no answer. Or do you deny that his comments on this matter
>> of property are true?
 
>His comments are not applicable to America. They are applicable to a 
> country where the government owns the economy.
 
>No reply is needed to his comments except to point out that they only 
> apply to a communist or totalitarian state. We don't have one here, so his 
> argument doesn't apply.

The last time I looked, property taxes were enforced in many states of
the USA. Do you deny this?
 
>I am not saying "because you are a communist, your argument is wrong". I 
> am saying, "because your argument is based upon communist or totalitarian 
> premises about the relationship between the government and the economy, it 
> does not apply to the United States, and we were talking about the United 
> States."
 
Then you are sadly deluded if you think that the US government does not
make decisions on the economy.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-24 Thread axel
In comp.lang.perl.misc David Schwartz <[EMAIL PROTECTED]> wrote:
 
>This is about whether we're talking *ABOUT* America, you idiot. It's as 
> if he said the press has no freedom, and I replied, "if you want to talk 
> about some country where that's true, fine, but this discussion presumed 
> America as the basis".
 
>Remember, he is the one who said the government owned the economy. That 
> may be true in some countries, but it's simply *FALSE* in this country. Our 
> government has limited powers and ownership of the economy is not one of 
> them.

I see that you cannot make a reasoned argument against the fact that
property in the form of houses is taxed in America.

Also may I remind you that these newsgroups are international.

Axel
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-24 Thread axel
In comp.lang.perl.misc Roedy Green <[EMAIL PROTECTED]> wrote:
> On Mon, 24 Oct 2005 12:35:13 GMT, [EMAIL PROTECTED] wrote,
> quoted or indirectly quoted someone who said :
 
>>I see that you cannot make a reasoned argument against the fact that
>>property in the form of houses is taxed in America.
 
> And what has his inability to do that to your satisfaction got to do
> with the price of eggs?

Not that I care much since eggs bring on a rather strong reaction
within me, but his arguments were totally false.

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-26 Thread axel
In comp.lang.perl.misc Steven D'Aprano <[EMAIL PROTECTED]> wrote:
 
>> Heck, I dunno.  Like you, I don't even really care all that much.  
 
> You don't care that innovation in desktop software has been crippled by
> the actions of the monopoly player Microsoft?
 
> In 1988, there were something like ten or a dozen word processors
> available to choose from, and they were competing on price and features

Yes... I think I used a couple around then.

> like crazy. That was then, now there is just MS Office. The most
> innovative things Microsoft has added to Office in the last decade? Clippy

Er... Open Office, Apple Works.

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to write a tutorial

2005-01-28 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> Following is a tutorial on Python's classes. It is part of a
> a-Python-a-day mailing list. As an example, it shows what i mean by
> covering the language's functionalities as is, without needing to chalk
> up to rocket sciences. If expanded slightly and edited, it can supplant
> sections 9.0 to 9.4 of the Python tutorial. Languages Tutorials should
> follow this style.
 
It is crap, not a tutorial, but just an aide-memoire for someone who
presumably knows the stuff anyway.

And keep it where it belongs please.

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-12 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> The other class of jargon stupidity is from computing practitioners, of
> which the Unix/Perl community is exemplary. For example, the name Unix
> & Perl themselves are good examples of buzzing jargons. Unix is
> supposed to be opposed of Multics and hints on the offensive and
> tasteless term eunuchs.

Now that connexion is a product of a truely warped mind.

Axel



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-23 Thread axel
In comp.lang.perl.misc Chris Hills <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>, jan V
> <[EMAIL PROTECTED]> writes
>>>  +---+ .:\:\:/:/:.
>>>  |   PLEASE DO NOT   |:.:\:\:/:/:.:
>>>  |  FEED THE TROLLS  |   :=.' -   - '.=:
>>>  |   |   '=(\ 9   9 /)='
>>>  |   Thank you,  |  (  (_)  )
>>>  |   Management  |  /`-vvv-'\
>>>  +---+ / \
>>>  |  |@@@  / /|,|\ \
>>>  |  |@@@ /_//  /^\  \\_\
>>>@x@@x@|  | |/ WW(  (   )  )WW
>>>\/|  |\|   __\,,\ /,,/__
>>> \||/ |  | |  jgs (__Y__)
>>> /\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
>>
>>Please don't use ASCII art... not everyone uses a fixed-width font for his
>>newsreader...
 
> I thought usenet specified fixed font. If you  use something else don't
> complain. 
 
> The Troll don't look pretty in fixed font either:-)

I don't think trolls are supposed to look pretty, but rather ugly.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-26 Thread axel
In comp.lang.perl.misc Mike Schilling <[EMAIL PROTECTED]> wrote:
> "Denis Kasak" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>> Mike Schilling wrote:

>>> I see a difference between "X would be useful for A, B, and C" and "Y 
>>> will always be the only proper way."

>>> Don't you?

>> Y would not be useful because of the bandwidth it consumes, the malware it 
>> would introduce, the additional time spent focusing on the format rather 
>> than quality of the content and, frankly, because it's useless.
 
> Threaded mail-readers too, screen-based editors , spell-checkers, all 
> useless frills.

All dependent on and only affecting the user who employs them. It
does not require other users to do anything.

It is none of my business whether you used vi, emacs, ed or whatever
to compose your message; whether you ran a spell checker over it;
or how you read messages and respond to them - perhaps you telnet'd
to the news server and made your transactions manually.

Axel
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-27 Thread axel
In comp.lang.perl.misc John Bokma <[EMAIL PROTECTED]> wrote:
> Chris Head <[EMAIL PROTECTED]> wrote:
 
>> What advantages would those be (other than access from 'net cafes, but
>> see below)?
 
> And workplaces. Some people have more then one computer in the house. My 
> partner can check her email when I had her over the computer. When I 
> want to check my email when she is using it, I have to change the 
> session, fire up Thunderbird (which eats away 20M), and change the 
> session back.
 
Not a Windows solution, but I find the 'screen' utility invaluable as
I can have my email, news, and an editor open in different screens
and then when I need to move to a different machine, I can simply
detach and reattach screen without disturbing anything that
might be running.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-29 Thread axel
In comp.lang.perl.misc Mike Meyer <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] writes:
>> In comp.lang.perl.misc John Bokma <[EMAIL PROTECTED]> wrote:
>>> Chris Head <[EMAIL PROTECTED]> wrote:
>>>> What advantages would those be (other than access from 'net cafes, but
>>>> see below)?
>>> And workplaces. Some people have more then one computer in the house. My 
>>> partner can check her email when I had her over the computer. When I 
>>> want to check my email when she is using it, I have to change the 
>>> session, fire up Thunderbird (which eats away 20M), and change the 
>>> session back.
>> Not a Windows solution, but I find the 'screen' utility invaluable as
>> I can have my email, news, and an editor open in different screens
>> and then when I need to move to a different machine, I can simply
>> detach and reattach screen without disturbing anything that
>> might be running.
 
> For a more  portable solution, check out VNC.
 
I know... but it is a bugger to set up and I believe it is no longer
freeware (if it ever was), and it does not have the stark simplicity
which screen has... I only need to have a compiled version of screen
on the machine on which I do most of my work and be able to ssh/telnet
to that machine without involving any additional software installations
on other machines.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-08-30 Thread axel
In comp.lang.perl.misc John Bokma <[EMAIL PROTECTED]> wrote:
> Alan Balmer <[EMAIL PROTECTED]> wrote:
 
>> On 29 Aug 2005 21:12:13 GMT, John Bokma <[EMAIL PROTECTED]> wrote:
 
>>>> Now, go away. And please, stay away.

>>>Like I already said, it doesn't work that way.

>> Goodbye, John. Filters set.

> Saidly you didn't get the message. Moreover you think that the Usenet 
> /needs/ a public ploink message. Get a clue. People like you add more noise 
> to Usenet compared to a thread which runs a bit wide.

Why do I think of a Dutch expression 'mieren neuker' with regards to
Balmer's posts?

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-09-02 Thread axel
In comp.lang.perl.misc John Bokma <[EMAIL PROTECTED]> wrote:
> "T Beck" <[EMAIL PROTECTED]> wrote:
 
>> I suppose I was (as many people on the internet have a bad habit of
>> doing) being more caustic than was strictly necessary.  I don't really
>> forsee the death of usenet anytime soon, I just don't think the idea of
>> it evolving is necessarily bad.  I don't really have alot of vested
>> interest one way or the other, to be honest, and I'm perfectly happy
>> with the way it is.
 
> me too.
 
>> I just think it's a naive view to presume it never will change, because
>> change is what the internet as a whole was built on.
 
> I can't think of changes that are coming to Usenet (other then ipv6)

The old saying holds true - if it is not broken, do not fix it.

Of course what the original poster did not consider is why
the standard line length was laid down... the VT100 terminals
(and related ones) had a line length which was 80 characters
(ok, with some options to switch to 132 characters if I
remember correctly)... and that is the first machine through
which I access Usenet. And the version of vi which I used
at the time was not very good with dealing with long lines.
But it worked.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] combinatorics fun

2005-02-10 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> a year ago i wrote this perl program as part of a larger program.
 
> sub combo ($) {
>my $max=$_[0];
>my %hh=();
>for (my $j=1; $j < $max; ++$j) {
>for (my $i=1; $i <= $max; ++$i) {
>my $m = (($i+$j)-1)%$max+1;
>if ($i < $m){ $hh{"$i,$m"}=[$i,$m];}
>}
>}
>return \%hh;
> }
 
Well, it's not obfuscated Perl. It is, however, an obfuscated algorithm.

Sane people would use something along the lines of:

sub combo {
my $max = shift;
my %hh=();
for my $i ( 1 .. $max ) {
for my $j ( $i + 1 .. $max ) {
    $hh{"$i,$j"} = [$i, $j];
}
}
return \%hh;
}

 
Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python docs [was: function with a state]

2005-03-25 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> The Python doc is relatively lousy, from content organization to the
> tech writing quality.

Which has precisely what to do with most of the groups to which you
cross-posted?

> Problem: They all have the same priority (which is higher than that of
> the Boolean operations).
 
> However, the ?they? pronoun from the context of previous sentence,
> refers to ?the comparison operation?, not ?operator?. So, it
> conjures the reader to think about some ?operation precedence?,
> which in itself cannot be ruled out as nonsense depending on the
> context. Very fucking stupid confusional writing.

The meaning is perfectly plain. By the way did you perhaps mean
'confusing' or 'confused'? I normally regard language flames
otiose but here, since you are trying to correct other people's
writing, fair game.

> And, from pure writing aspect, the sentence ?...(which is ...)?  is
> some kind of a juvenile latch on. If the author intent to make that

Do you mean... 'if the author's intent is to make' or 'if the author
intends to'?

> point, say it in its own sentence. e.g. The comparison operators have
> higher precedence than boolean operators. It would be better to not
> mention this at all. For practical considerations, very rare is the
> case of mixing boolean and comparison operators, and if so, parenthesis
> are likely used and is indeed a good practice. The proper place for

Should that not be 'parentheses are likely to be used'?

It is not rare at all. Besides, little asides like this are an ideal
way to reinforce thoughts about operator preference and more helpful
then memorising a table.

> Problem: Comparisons can be chained arbitrarily; for example, x < y <=
> z is equivalent to x < y and y <= z, except that y is evaluated only
> once (but in both cases z is not evaluated at all when x < y is found
> to be false).
 
> Drop the word ?arbitrarily?. It has no meaning here.

I suggest you look up the meaning of the word.
 
> the whole sentence is one fucked up verbiage of pell-mell thinking and
> writing. Here's one example of better:
 
> Comparisons can be chained, and is evaluated from left to right. For
> example, x < y <= z is equivalent to (x < y) <= z.

You mean 'are evaluated'. Your rephrasing is also incomplete since
it doesn't note that z will not be evaulated if x < y is false.

> With respect to documentation style, it is questionable that this
> aspect needs to be mentioned at all. In practice, if programers need to
> chain comparisons, they will readily do so. This is not out of ordinary
> in imperative languages, and evaluation from left to right is also not
> extraordinary to cost a mention.

Really? In a reference manual such matters should be fully specified
regardless of what happens in other languages.
 
> Problem: <> and != are alternate spellings for the same operator. != is
> the preferred spelling; <> is obsolescent
 
> In general, when something is obsolete or might go defunct in the
> future, consider not even mentioning that construct. If necessary, add
> it in a obscure place, and not adjacent to critical info. In many
> places of Python documentation, this is breached.

Really? Actually it is very important to mention it in the correct
place in a reference manual. Do you understand the concept of
maintaining old code?
 
> I'm in fact somewhat surprised by this poor quality in writing. The

Really? The writing in the manual seems simple, straight-forward and
clear to me (knowing no Python). Unlike your writing.

> more egregious error is the hardware-oriented organization aka
> technical drivel.

What on earth does this mean?

> The Python doc, though relatively incompetent, but the author have
> tried the best. This is in contrast to documentations in unix related
> things (unix tools, perl, apache, and so on etc), where the writers
> have absolutely no sense of clear writing, and in most cases don't give
> a damn and delight in drivel thinking of it as literary.

I think that this is an excellent description of your own writing.

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> The answer to the questions are resounding yeses, you fucking asses.
 
> paypal me a hundred dollars and i'll rewrite the whole re doc in a few
> hours.
 
> Fuck you the standard IT morons. Excuse me for i didn't have time to
> write a more coherent and detailed analysis of the stupidities of the
> re doc.
 
Don't worry! Very soon, some nice men in white coats will show you
a comfortable room with soft walls in which you can write such
documentation to your hearts content.

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python or PHP?

2005-04-26 Thread Axel
Jeremy Bowers <[EMAIL PROTECTED]> wrote:
> Nobody ever changed their mind as a result of a 20-thread endless
> reply-fest. As usual, the posters aren't about to admit anything, and none
> of the bystanders are reading any more.

Well I am reading... always interested to learn.

Axel




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft's JavaScript doc's newfangled problem

2005-12-28 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> If (1), then it would be a fucking incompetence of inordinate order. If

Have you ever thought that your cross-postings are "incompetence
of inordinate order"?

Of course not since you are a troll.

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Jython: PyException toString() is empty

2006-09-01 Thread axel
Hello,

I have the problem to get informations about script errors. And I have
found that I get a PySyntaxError if the script is wrong and if I use
for instance an unknown name I get PyException. But I don't get any
information, not even a string.
How can I get detailed informations about the error?

Thanks, axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Jython: single step / pause / debug ...

2006-09-01 Thread axel
Hello,

I want to integrate Jython into my java application. But I want to
control the script execution. How can be realized this? I have used
TraceFunction and the script stops alway in traceCall().
But (1) I have never seen what I have to return there, (2) only this
function is called - also if there is an error in the script and (3)
what I have to do to pause/stop the script?

Thanks, Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Python regex Doc

2005-05-07 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> Let me expose one another fucking incompetent part of Python doc, in
> illustration of the Info Tech industry's masturbation and ignorant
> nature.
 
> Note the need to inject the high-brow jargon “greedy” here as a
> latch on sentence.
 
> “never greedy”? What is greedy anyway?
 
> “Greedy”, when used in the context of computing, describes a

When used in terms of Usenet, I think it can be applied in the sense
of 'a troll who is greedy for attention'.

Hence the saying 'do not feed the troll'.

Axel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Python regex Doc

2005-05-13 Thread axel
In comp.lang.perl.misc John Bokma <[EMAIL PROTECTED]> wrote:
> If you had really any point, you didn't need to swear in every third 
> sentence. Nor bother so many groups with your rants.
 
> If you think it can be done better, pick up a part of documentation, and 
> rewrite it. To make it very hard, you are not allowed to use fuck, fucking,  
> fucked, ass, asses or other similar words, which in the way you use them 
> show quite some lack of both creativity and writing skills.

Oh please let him use an ass... then we might not see him again for
several months nutil his donley comes over the hill.

Axel

 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python documentation problem

2005-06-18 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote:
> i wanted to find out if Python supports eval. e.g.
 
> somecode='3+4'
> print eval(somecode) # prints 7
 
> in the 14 hundred pages of python doc, where am i supposed to find this
> info?
 
By using the index - it's an alphabetical list of names and topics.

Follow-ups set.

Axel


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Xah's Edu Corner: The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations

2006-03-17 Thread axel
In comp.lang.perl.misc Timo Stamm <[EMAIL PROTECTED]> wrote:
> Fuzzyman schrieb:
>> Roedy Green wrote:
>>> On 15 Mar 2006 22:20:52 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote,
>>> quoted or indirectly quoted someone who said :
>>>
>>>> e. For example, the in-fix
>>>> notation =E2=80=9C(3+(2*5))>7=E2=80=9D is written as =E2=80=9C3 2 5 * + 7 
>>>> >=
>>>> =E2=80=9D, where the
>>> Not that Mr. Lee has ever shown much interest in feedback, but you
>>> pretty well have stick to vanilla ASCII to get your notation through
>>> unmangled on newsgroups.
 
>> Hmmm... it displays fine via google groups. Maybe it's the reader which
>> is 'non-compliant' ?

> Other charsets than US-ASCII are widely accepted in non-english 
> newsgroups as long as the charset is properly declared.
 
> Xah's posting was properly encoded and will display fine in every decent 
> newsreader.

It is not just the question of the newsreader, it is also a question of whether
the character set/font being used is capable of displaying the characters
concerned. 

Axel
 
-- 
http://mail.python.org/mailman/listinfo/python-list


3.2: email.message.get_payload() delivers str, but send_message expect bytes

2011-04-08 Thread Axel Rau
Hi all,

I'm just starting with imaplib, email and smtplib and try to write a
SPAM reporter. I retrieve SPAM mails from an IMAP server and add them as
message/rfc822 attachments to a report mail.
Sometimes my call of smtplib.send_message works, sometimes, I get:
--
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/smtplib.py",
line 771, in send_message
rcpt_options)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/smtplib.py",
line 739, in sendmail
(code,resp) = self.data(msg)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/smtplib.py",
line 495, in data
q = _quote_periods(msg)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/smtplib.py",
line 165, in _quote_periods
return re.sub(br'(?m)^\.', '..', bindata)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/re.py",
line 167, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: sequence item 1: expected bytes, str found
--
When I query the class of my pyloads, they always show up as strings.
The test case, which always fails is an oversized SPAM, which my script
must truncate. I do this by removing MIME parts from the end (just
deleting items from the list, describing the multipart structure).

Another problem comes up, when I try to encode the payload of the whole
report mail, I get always:
---
  File "erdb_bt.py", line 195, in flushReports
email.encoders.encode_base64(self.msg)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/email/encoders.py",
line 32, in encode_base64
encdata = str(_bencode(orig), 'ascii')
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/base64.py",
line 56, in b64encode
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not list
---
What am I doing wrong?

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 3.2: email.message.get_payload() delivers str, but send_message expect bytes

2011-04-12 Thread Axel Rau
On 08.04.11 13:43, Axel Rau wrote:
> line 167, in sub
> return _compile(pattern, flags).sub(repl, string, count)
> TypeError: sequence item 1: expected bytes, str found
I just filed issue 11837.

Axel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: To clarify how Python handles two equal objects

2023-01-13 Thread Axel Reichert
 writes:

> As an example, you can create a named slice such as:
>
>   middle_by_two = slice(5, 10, 2)
>
> The above is not in any sense pointing at anything yet.

>From a functional programming point of view this just looks like a
partially applied function, and with this in mind the behaviour to me
seems to be completely as expected. No surprises here, or do I miss
something?

Best regards

Axel
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Integrating Python into a C++ app

2005-01-03 Thread Axel Diener


-Original Message-
From: Ben Sizer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 04, 2005 2:14 AM
To: python-list@python.org
Subject: Integrating Python into a C++ app


I know the conventional wisdom is to write the whole app in Python and
only extend with C++ where speed is an issue, but I already have a
large C++ app that I'd like to add Python to. Ideally I'd rewrite the
whole app in Python but I don't have time to do that and maintain the
old system at the same time. So my next thought was to perhaps
integrate the two and slowly migrate modules and classes across from
C++ to Python. If it matters, the main reason I'm interested in doing
this is because I appreciate the productivity of Python and would like
to take advantage of that as I add features to the current code, to
reduce bugs and cut development time.

I've read a few good things in this group about Elmer
(http://elmer.sourceforge.net), but I'm not sure how simply that
accommodates calls in the reverse direction (from Python code back into
C++). Are there any other options that would require a minimum of
rewriting of code? Does anybody have any experience of such a project?
--
Ben Sizer


Even embedding Python in a C++ Application is an easy task. I work at such
an application since about five years. For the first steps in doing this I
advice you to study the source code of the modpython apache extension.
There you will see how embedding may be implemented. Bur embedding does not
work well without extending. For this part I use PyCXX from
http://sourceforge.net/projects/cxx/.

Axel Diener

-- 
http://mail.python.org/mailman/listinfo/python-list


Generating modul classes with eval

2005-02-02 Thread Axel Straschil
Hello!

I was fooling around with creating classes for a module with eval,
something like:

MyModule.py:

class Base:
init(self, name):
self._name = name

for myclass in ['A', 'B', 'C']:
code="class %s(Base):\n\tinit(self, name='%s')\n\t\tsuper(%s,
self).__init(name=name)\n"%dict(myclass, myclass.lower(), myclass())
... codeop and eval stuff ...
a=A()
print a

that gives: , but I want MyModule.A ;-)

Can someone give me a hint how to create classes in a module with eval
and codeop so that they exist like the code was written in?

Thanks, 
AXEL.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generating modul classes with eval

2005-02-03 Thread Axel Straschil
Hello!

> Note that we don't need eval anywhere.

Uuups, that looks realy cool! Thanks for that!

Im fooling around with generating html-tags. As there are only two kind
of html tags, one who can nest chields, and one who cant, i wantet to
play arround with something like:

I've got two base classes, _Tag and _ContainerTag (for tags which can
nest tags). Instead of getting an htmltag with _Tag(name='html'), I
want to have a class for each html-tag. So, I thought of creating that
classes dynamicly.

my now (nearly) working code is:

class _Tag(object):
def __init__(self, name, flags=None, **props):
[...]

class _ContainerTag(_Tag):
def __init__(self, name, contents=None, flags=None, **props):
super(_ContainerTag, self).__init__(name=name, flags=flags, 
**props)
self._contents = coalesce(contents, [])


_module_name = sys.modules[__name__]

class_dic = {}
class_dic['Br'] = _Tag
class_dic['Hr'] = _Tag
class_dic['Html'] = _ContainerTag
class_dic['Table'] = _ContainerTag

for class_name, class_base in class_dic.items():
class TmpClass(class_base):
def __init__(self, **props):
name = class_name.lower()
#super(TmpClass, self).__init__(name=name, **props)
class_base.__init__(self, name=name, **props)
setattr(_module_name, class_name, TmpClass)

br = Br()
print br
table = Table()
print table

br is printed OK, but for table, I get:
AttributeError: 'TmpClass' object has no attribute '_contents'
so, it seems that __init__ of _Tag is not called. 
If I try to do the commented line
super(TmpClass, self).__init__(name=name, **props)
instead of
class_base.__init__(self, name=name, **props)
I get:
 TypeError: super(type, obj): obj must be an instance or subtype of
 type
for print table, print br ist processed OK.


Thanks for help and your perfekt examples,
AXEL.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generating modul classes with eval

2005-02-03 Thread Axel Straschil
Hello!

> After the loop has finished, the global variable TmpClass will be bound to
> whatever class was created last, and the variable class_base will be bound
> to that the base class of that same TmpClass. Therefore only this last class
> is guaranteed to work as expected.

Great, now it workes!

_module_name = sys.modules[__name__]
def _tag_class_factory(name, base):
class T(base):
def __init__(self, **props):
super(T, self).__init__(name=name.lower(), **props)
setattr(_module_name, name, T)
class_dic = {}
class_dic['Br'] = _Tag
class_dic['Hr'] = _Tag
class_dic['Html'] = _ContainerTag
class_dic['Table'] = _ContainerTag
class_dic['Td'] = _ContainerTag
class_dic['Tr'] = _ContainerTag
for name, base in class_dic.items():
_tag_class_factory(name, base)
print Table(contents=[Tr(contents=[Br()])])

gives: 

Thanks,
AXEL.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Html or Pdf to Rtf (Linux) with Python

2004-12-15 Thread Axel Straschil
Hallo!
However, our company's product, PDFTextStream does do a phenomenal job of 
extracting text and metadata out of PDF documents.  It's crazy-fast, has a 
clean API, and in general gets the job done very nicely.  It presents two 
points of compromise from your idea situation:
1. It only produces text, so you would have to take the text it provides and 
write it out as an RTF yourself (there are tons of packages and tools that do 
this).  Since the RTF format has pretty weak formatting capabilities compared
I've got the Input Source in HTML, the Problem ist converting from any to 
RTF. Please give me a hint where the tons of packages are.

Thanks,
AXEL.
--
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in RFC 2119 [http://ietf.org/rfc/rfc2119.txt]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Html or Pdf to Rtf (Linux) with Python

2004-12-16 Thread Axel Straschil
Hello!

> That's easy. Load the HTML in MS Word, and save it as RTF. Script it
> via COM using the python win32all (I think that's what it's now
> called) package.

As I wrote in my posting and the subject: linux ;-)
I could try to do this with open office, by I'm afraid this will not
be a performant solution ;-(
I realy was spending hour's on that, the only thing I found was a
spezifikation for reach text, maybe a good point to start a project ...

Lg
AXEL.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Html or Pdf to Rtf (Linux) with Python

2004-12-16 Thread Axel Straschil
Hello!

> I've been able to successfully get konqueror to generate a pdf from a
> html file via dcop. It's something along the lines of:

For that stuff, I'm using htmloc (http://www.htmldoc.org/).

Lg,
AXEL.
-- 
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in RFC 2119 [http://ietf.org/rfc/rfc2119.txt]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Html or Pdf to Rtf (Linux) with Python

2004-12-17 Thread Axel Straschil
Hello!

> You might take a look at PyRTF in PyPI. It's still in beta,

I think PyRTF would be the right choice, thanks. Yust had a short look
at it.

Lg,
AXEL.
-- 
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in RFC 2119 [http://ietf.org/rfc/rfc2119.txt]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Html or Pdf to Rtf (Linux) with Python

2004-12-14 Thread Axel Straschil
Hello!

Sorry Cameron, I was replying, now my folloup ;-):

> Are you trying to convert one document in particular, or automate the
> process of conveting arbitrary HTML documents?

I have an small CMS System where the customer has the posibility to view
certain Html-Pages as Pdf, the CMS ist Python based. I also thought
about
passing the Url to an external converter Script, but found nothing ;-(


> What computing host is available to you--Win*?  Linux?  MacOS?
> Solaris!?

Linux

> Is Word installed?

No.

> OpenOffice?

Yes.

> Why have you specified Python?

Becouse I like Python ;-)
The System behind generating the HTML-Code is written in Python.

Thanks,
AXEL.

-- 
http://mail.python.org/mailman/listinfo/python-list


Calling __init__ with multiple inheritance

2005-03-28 Thread Axel Straschil
Hello!

Im working with new (object) classes and normaly call init of ther
motherclass with callin super(...), workes fine.

No, I've got a case with multiple inherance and want to ask if this is
the right and common case to call init:

class Mother(object):
def __init__(self, param_mother): print 'Mother'
class Father(object):
def __init__(self, param_father): print 'Father'
class Child(Mother, Father):
def __init__(self, param_mother, param_father): 
Mother.__init__(self, param_mother)
Father.__init__(self, param_mother)
child = Child(1, 2)

Thanks, AXEL.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calling __init__ with multiple inheritance

2005-03-28 Thread Axel Straschil
Hello!

Thanks to all for the very interesting postings!

I came to the following:

For single inheritance, super is a nice tool if you will recfactoring
the class later. 

For multiple inheritance, if you want to use super, you have to have
very much knowledge of the classes you inheritance. For me, OOP is to
not have to have the deep inner knowledge of the classes I inheritance
from. 

Also, for multiple inheritance, if think 
Mother1.__init__(self, ...)
Mother2.__init__(self, ...)
Mother3.__init__(self, ...)
would be more clear to read then
super(MyClass).__init__(Maby this will do some magic thing)

Also, I realy dislike 
__init__(self, param, **eat_some_needless_stuff)

If I later extend my class and also add some parameters to __init__,
what will happen to the classes using the baseclass?

Also, lool at that:
class Mother(object):
def __init__(self, param_mother='optional', **eat): 
print 'Mother'
class Father(object):
def __init__(self, param_father='optional', **eat): 
print 'Father'
class Child(Mother, Father):
def __init__(self, **ham): 
super(Child, self).__init__(**ham)
child = Child(param_mother=1, param_father=1)

Father's init will not be called.

Thanks,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calling __init__ with multiple inheritance

2005-03-29 Thread Axel Straschil
Hello!

>> Also, lool at that:
>> class Mother(object):
>> def __init__(self, param_mother='optional', **eat):
>> print 'Mother'
>> class Father(object):
>> def __init__(self, param_father='optional', **eat):
>> print 'Father'
>> class Child(Mother, Father):
>> def __init__(self, **ham):
>> super(Child, self).__init__(**ham)
>> child = Child(param_mother=1, param_father=1)
>> Father's init will not be called.
> Change Father/Mother.__init__() to call the superclass initializer. It may
> be counterintuitive, but it works.

OK, thanks, with the super(...).__init__() in Father/Mother it workes
and makes sense.

So, the last thing a *realy* don't like ist the
__init__(self, param, **ignore_the_rest) thing. 

Anyone had troubles with that, or should I cust take this as a "python
way of thinking" ... ;-), and getting used to that?

Thanks,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generating RTF with Python

2005-03-31 Thread Axel Straschil
Hello!

> does anyone know of a high-level solution to produce RTF from Python=20
> (something similar to
> Reportlab for producing PDF)?

Spend hours of googeling and searching, also in this NG, about two
months ago. My conclusion is: On windwos, maybe you can include some
hacks with dll's, under linux, linux support for generating rtf is none,
and so is python's.

My workaround was: 
http://www.research.att.com/sw/download/
This includes an html2rtf converter, which I access from python via
popen and temporary files. Not high-level, not very sexy ... ;-(

Lg,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generating RTF with Python

2005-03-31 Thread Axel Straschil
Hello!

> I looked at this a while ago, which might be a starter.
> http://pyrtf.sourceforge.net/

Don't remember why I didn't spent much time on that. Sombody has
experience with pyrtf on an production project (is it stable ;-))

Lg,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE like NetBeans/Delphi IDE

2005-04-05 Thread Axel Straschil
Hello!

> WingIDE (commercial, slower than PythonWin but has many features)

You can use and reactivate a trial licence for WingIDE for a realy long
term, give it a try, i bought a licence last week and realy love it!

Lg,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Multiple inheritance: Interface problem workaround, please comment this

2005-04-07 Thread Axel Straschil
Hello!

I'm working on an HTML/Cgi widget's class where multiple inheritance
well be sometime a great thing.

I solved all my problems for pythons multiple inheritance with this ng,
thaks to all again, but there is one think I still dislike:

class A(object):
def __init__(self, a=None, **__eat): 
print "A"
super(A, self).__init__()
class B(object):

def __init__(self, b=None, **__eat): 
print "B"
super(B, self).__init__()

class AB(A, B):
def __init__(self, a=None, b=None): 
super(AB, self).__init__(a=a, b=b)

ab = AB()

This looks (and I think is) correct, but I realy dislike the **__eat
stuff. As in python everything is virtual, I found no better solution to
do that. In my real world, i've got constucts like:
class A(object)
class B(A)
class AB(A,B)
(not realy  so ugly like that ;-), just to say I can work only with super to 
call __init__).
 
My problem: If you make a coding mistake, and the mistake does not give
a runtime error becouse **__eat is a hungry evil beast, it would be very
hard to debug ... think of a wrong written parameter!

So, here is my workaround, please comment this, if someone has a better
solution I would be glad:

class A(object):
def __init__(self, a=None, _do_eat=False, **__eat): 
if __eat and not _do_eat: raise "I'm not hungry"
print "A"
super(A, self).__init__()

class B(object):
def __init__(self, b=None, _do_eat=False, **__eat): 
if __eat and not _do_eat: raise "I'm not hungry"
print "B"
super(B, self).__init__()

class AB(A, B):
def __init__(self, a=None, b=None): 
    super(AB, self).__init__(a=a, b=b, _do_eat=True)

ab = AB()

Thanks, 
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple inheritance: Interface problem workaround, please comment this

2005-04-07 Thread Axel Straschil
Hello!

> (1) make A or B a mixin class that doesn't need __init__ called, or

Would be a solution for classes that just give functionality, no
data-structures. In that case, i would use functions, no classes ;-)

I've seen code where there are classes without init and the hope that
self has what they expect, not realy the blackbox oop should produce!

> (2) make class AB inherit from A and delegate to B (or vice versa)

As every multiple inheritance can be solved as single inheritance, if no
better solution for my "hungry monster problem" is found, this would be
the best way. Don't take my AB example as a real word example ;-)

Also think of to libraries with classes which have inheritance depth
five or more (that's what I've got). Somtimes you want to stick things
together without knowing the inheritance tree.

So, if there are ready class-modules, and I want to use them for
multiple inheritance, I've to rewrite the init's of classes in the
module!

For me, python is the best solution in oop-webprogramming (tried perl,
got ugly code, tried php, got php ;-), tried C++, takes too long for web
projects). The only thing I'm dislike is the super thing with multiple
inheritance, maby I shoud see pythons multiple inheritance as a nice to
have and not to use thing ;-)

Thanks,
AXEL.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can dictionary values access their keys?

2005-04-08 Thread Axel Straschil
Hello!

> If I have a simple dictionary, where the value is a class or function,
> is there an interface through which it can discover what its key is?

The key of a value may not be unique, so you can also get a tupe of
keys, like dict(a=1, b=1), the key's of 1 are a and b.

For unique values, I did something like that couple of weeks ago, the
thing you would need is the getKey thing, it's fast, but needs much
memory for big structures becouse I use two dicts.
If speed does not matter:

class ReverseDict(dict):
def get_keys(self, value):
keys = []
for k, v in self.items():
if v == value: keys.append(k)
return keys

class UniqueReverseDict(dict):
"""
A dictionary that can resolute reverse: A object to a key. Both, the 
Key and
the Value must be unique.
"""

def __init__(self, **kws):
super(UniqueReverseDict, self).__init__(kws)
self.__reverse = {}

def __setitem__(self, k, v):
super(UniqueReverseDict, self).__setitem__(k, v)
self.__reverse[v] = k

def __update_reverse(self):
self.__reverse.clear()
for k, v in self.items():
self.__reverse[v] == k

def has_value(self, v):
return self.__reverse.has_key(v)

def __delitem__(self, k):
self.__reverse[self[k]] 
super(UniqueReverseDict, self).__delitem__(k)

def clear(self):
self.__reverse.clear()
super(UniqueReverseDict, self).clear()

def copy(self):
return UniqueReverseDict(self)

def pop(self, k):
del self.__reverse[self[k]]
return self.pop(k)

def popitem(self, **kws): 
raise 'AxsPy.Misc.Structures.UniqueReverseDict', \
'NotImplemented'

def setdefault(self, **kws): 
raise 'AxsPy.Misc.Structures.UniqueReverseDict', \
'NotImplemented'

def update(self, **kws):
super(UniqueReverseDict, self).update(**kws)
self.__update_reverse()

def getKey(self, v): return self.__reverse[v]

Lg,
AXEL
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can dictionary values access their keys?

2005-04-08 Thread Axel Straschil
Hello!

> thousands more entries. So we're talking about maybe a million+ total
> nested key:values. I don't know if that counts as large or not. I can't
> even guess how much k memory that is.

Mhh, maybe you should use a SQL-Database ;-)

Lg,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple inheritance: Interface problem workaround, please comment this

2005-04-09 Thread Axel Straschil
Hello!

> from decorate import decorate # see today thread on decorators for this

Gives me an ImportError: No module named decorate. I've got to donwload
that? (python 2.4)

Thanks,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple inheritance: Interface problem workaround, please comment this

2005-04-11 Thread Axel Straschil
Hallo!

> Look at the comment in the code! I have posted the "decorate" module in

Uuups, sorry, I'll RTFM myselfe *g*

Lg,
AXEL.
-- 
"Aber naja, ich bin eher der Forentyp." Wolfibolfi's outing in 
http://www.informatik-forum.at/showpost.php?p=206342&postcount=10
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reusing object methods?

2005-04-29 Thread Axel Straschil
Hello!

Why not:

> class A:
>  def a_lengthy_method(self, params):
>   # do some work depending only on data in self and params
>
> class B(A): pass

?

Lg,
AXEL.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to get/set class attributes in Python

2005-06-12 Thread Axel Straschil
Hello!

> You can 'hide' you getsetters using a property attribute[1]:

For me, the property attribute is a beast:

class A(object):
def getP(self): return 'A'
p = property(getP)
class A2(A):
def getP(self): return 'A2'
a = A()
a2 = A2()
print a.getP(), a2.getP()
print a.p, a2.p

So, property is instance-level super() tool ;-)

Lg,
AXEL.
-- 
Gentoo? Debian? RedHat? SuSE? *BSD? Stop the distri-war, make little user!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: COM object pointer cast

2006-04-19 Thread Axel Bock
late but still - thanks a lot :) . works like a charm. 

cheers, 
Axel.

-- 
http://mail.python.org/mailman/listinfo/python-list


COM object pointer cast

2006-03-27 Thread Axel Bock
Hi,

I am fooling around with the Python-COM bridge, and I have a little
question with that.

In the component I am using is a method which will return an "Entry"
object - basically. In truth it returns some object which inherits from
entry, and I know which one, but - as said - the method will only
return the IEntry interface pointer. Now I would like to cast that one
to the one I need :) . Is there an easy way to do it, or do I have to
use the QueryInterface-method to get what I want?


Greetings & thanks in advance, 

Axel.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xor operator

2023-11-13 Thread Axel Reichert via Python-list
Barry  writes:

> I do not understand how xor(iterator) works.
> I thought xor takes exactly 2 args.

See

  https://mathworld.wolfram.com/XOR.html

for some background (I was not aware of any generalizations for more
than 2 arguments either).

> I also do not understand how xor can be short circuited.

Me neither, but that could be related to the meaning of n (which I did
not get) in the OP's question. Maybe he can clarify.

Best regards

Axel
-- 
https://mail.python.org/mailman/listinfo/python-list