On Mon, Apr 1, 2024 at 1:26 PM HenHanna via Python-list <
python-list@python.org> wrote:
> Johanne Fairchild wrote:
>
> > HenHanna writes:
>
> >> https://xkcd.com/1306/
> >> what does SIGIL mean?
>
> > A glyph used in magic. Or, for Perl, the symbol in front of a
On Mon, Feb 27, 2023 at 3:56 AM inhahe wrote:
>
>
> On Mon, Feb 27, 2023 at 3:52 AM Roel Schroeven
> wrote:
>
>> Op 26/02/2023 om 6:53 schreef Hen Hanna:
>> > > There are some similarities between Python and Lisp-family
>> > >
On Mon, Feb 27, 2023 at 3:52 AM Roel Schroeven
wrote:
> Op 26/02/2023 om 6:53 schreef Hen Hanna:
> > > There are some similarities between Python and Lisp-family
> > > languages, but really Python is its own thing.
> >
> >
> > Scope (and extent ?) of variables is one reminder that Python
sorry, I may have misused the term "namespace." I'm not sure what the
proper word is for the names currently loaded into the global scope.
On Fri, Jun 17, 2022 at 8:26 AM inhahe wrote:
> sys is a built-in module, but it's not in the namespace unless you import
> it first.
>
sys is a built-in module, but it's not in the namespace unless you import
it first.
before your print statement, enter "import sys"
On Fri, Jun 17, 2022 at 8:23 AM wrote:
> Thank you for your email.
>
> C:\Users\zszen>python.exe
> Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC
Maybe your file explorer is set to ignore system and/or hidden files, and
Python isn't? You can check that in folder settings..
On Wed, Dec 1, 2021 at 10:31 AM Ragavendar wrote:
>When the python runs in file explorer when I open a folder it shows NO
>ITEAMS FOUND and if I open same
On Sun, May 30, 2021 at 1:43 PM wrote:
> I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3
> at that time), but could not figure out how to use it to debug a python
> script that uses the curses module.
>
> Does anyone here know if winpdb-reborn or any other debugger can
I don't think attaching images works on this kind of list. Maybe send a
link to it..
On Mon, May 3, 2021 at 1:51 PM Osmany Guerra
wrote:
> Hi, I have problem with the python interpreter in the Visual Studio Code.
> It was running ok, but now isn't working. I have downloaded, installed and
>
I'm not sure if it's okay to ask about Twisted in this mailing list, but
Twisted's mailing list seems to have ignored my submission for some reason.
And their mailing list seems mostly dead anyway. So here goes:
I'm making an IRC client using Twisted, and I want to connect to a
different server
My editor of choice is Komodo IDE, which used to be commercialware but is
free now. I'm pretty sure it has dark modes, but I haven't used them. I
just thought I'd mention it because it's a good, solid IDE but I never see
anybody mention it, e.g. in lists of Python editors and such..
On Fri, Feb
Besides what others have said (especially re using a dict instead), I think
it's unpythonic/can result in unexpected behavior to change a list as it's
being iterated over. Your modified word_list should be a separate list, I
think.
Also, if you use enumerate(), you won't have to use .index and it
if 100 > grade >= 90:
On Mon, Nov 9, 2020 at 6:01 PM Quentin Bock wrote:
> grade = input("Enter your grade: ")
> if grade >= 90:
> print("You got an A ")
> if grade >= 80:
> print("You got a B ")
> if grade >= 70:
> print("You got a C")
> if grade >= 60:
> print("You got a D
On Sun, Nov 8, 2020 at 1:51 PM Quentin Bock wrote:
> Errors say that add takes 1 positional argument but 3 were given? Does this
> limit how many numbers I can have or do I need other variables?
> Here is what I have:
> def add(numbers):
>total = 1
>for x in numbers:
> total +=
>
>
> On Sat, Nov 7, 2020 at 8:51 AM Bischoop wrote:
>
>>
>>
>> So I was training with slicing.
>> Came to idea to remove text after second occurence of character, below
>> is how I've figured it out, I know if it works it good but how you
>> guys would made it in more pythonic way?
>>
>>
I know of a URL that explains asyncio:
https://hackernoon.com/a-simple-introduction-to-pythons-asyncio-595d9c9ecf8c.
As to your specific problem, I can't help and don't know if the URL helps.
I haven't studied asyncio much.
On Tue, Jun 23, 2020 at 3:53 PM Jonathan Gossage wrote:
> --
> I am
On Sun, Apr 5, 2020 at 8:26 AM Sathvik Babu Veligatla <
sathvikveliga...@gmail.com> wrote:
> hi,
> I am new to python, and i am trying to output the prime numbers beginning
> from 3 and i cannot get the required output.
> It stops after giving the output "7" and that's it.
>
> CODE:
> a = 3
> l =
> I have written a simple parser/evaluator that is sufficient for my
> simple requirements, and I thought I was safe.
>
> Then I saw this comment in a recent post by Robin Becker of ReportLab -
>
> "avoiding simple things like ' '*(10**200) seems quite difficult"
>
> I realised that my method
me.
> > Can someone help me with this
> > I can't find a solution to link the word high to 1.21.
> >
> > 11 print(add_vat(101, 'high'))
> > 12 print(add_vat(101, 'low'))
> >
> > Outcome:
> >
> > 122.21
> > 110.09
> >
> > Thanks!
On Tue, Sep 10, 2019 at 8:41 AM Pankaj Jangid
wrote:
> tim.g...@quicknet.nl writes:
>
> > For school i need to write the right code to get the following outcome.
> > Can someone help me with this
> > I can't find a solution to link the word high to 1.21.
> >
> > 11 print(add_vat(101,
On Tue, Sep 10, 2019 at 8:31 AM inhahe wrote:
>
>
> On Tue, Sep 10, 2019 at 8:10 AM tim.gast--- via Python-list <
> python-list@python.org> wrote:
>
>> Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef tim...@quicknet.nl:
>> > Hi everybody,
>> >
&
On Tue, Sep 10, 2019 at 8:10 AM tim.gast--- via Python-list <
python-list@python.org> wrote:
> Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef tim...@quicknet.nl:
> > Hi everybody,
> >
> > For school i need to write the right code to get the following outcome.
> > Can someone help me with
:
>
> On 6/28/19 1:33 PM, Chris Angelico wrote:> On Sat, Jun 29, 2019 at 6:31 AM
> Tobiah wrote:
>
> >> Also, what do people do when searching for a record.
> >> Is there some way to get 'Ronngren' to match the other
> >> possible foreign spellings?
> >
>
> I think I've heard of algorithms
Re cgitb, not sure if this is what you want, but I just came across this
this week: https://github.com/cknd/stackprinter
On Wed, May 22, 2019 at 3:52 AM Robin Becker wrote:
> In PEP 594 t has been proposed that cgi & cgitb should be removed. I
> suspect I am not the only person in the world
Short answer: (some generator expression) is for iterating over, as others
have said. try this:
print([fruit for fruit in favorite_fruits])
a loop would work too, as someone mentioned, but the result would be
different. you'd get your fruits separated by line breaks (or something
else if you
On Thu, May 2, 2019 at 5:26 AM wrote:
> Hey guys, can someone quickly explain why this piece of code doesn't work?
> (I'm really new to Python)
>
> birth_year = input("What year are you born? ")
> current_year = 2019
> age = current_year - birth_year
> print(age)
> --
>
I can display UTF-8 when I use wxPython:
--
import wx
app = wx.App()
s = 'testing\xf0\x9f\x98\x80'
frame = wx.Frame(None, wx.ID_ANY)
font = wx.Font("Arial")
textbox = wx.TextCtrl(frame, id=wx.ID_ANY)
textbox.SetFont(font)
textbox.WriteText(s)
frame.Show()
app.MainLoop()
--
But when I try
I need to make a list of instances of a Structure, then I need to make an
instance of another Structure, one of the fields of which needs to be an
arbitrary-length array of pointers to the instances in the list. How do I
do that?
Just in case it helps, I'll include what I tried that didn't work:
I hope this is an appropriate mailing list for BeautifulSoup questions,
it's been a long time since I've used python-list and I don't remember if
third-party modules are on topic. I did try posting to the BeautifulSoup
mailing list on Google groups, but I've waited a day or two and my message
i'm new to ctypes. can someone help me use sdl_pango with python?
here's the documentation: http://sdlpango.sourceforge.net/
here's my code:
-
import pygame
from ctypes import *
import win32api
MATRIX_TRANSPARENT_BACK_WHITE_LETTER =
say i have this definition:
1 typedef struct SDL_Surface {
2 Uint32 flags; /* Read-only */
3 SDL_PixelFormat *format;/* Read-only */
4 int w, h; /* Read-only */
5 Uint16 pitch;
On Aug 13, 4:07 pm, Peter Otten __pete...@web.de wrote:
inhahe wrote:
say i have this definition:
1 typedef struct SDL_Surface {
2 Uint32 flags; /* Read-only */
3 SDL_PixelFormat *format; /* Read-only */
4 int w, h
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
import inspect
def a(b=1): pass
...
inspect.getargvalues(a)
Traceback (most recent call last):
File stdin, line 1, in module
File
On Tue, Dec 29, 2009 at 5:10 PM, inhahe inh...@gmail.com wrote:
So i'm guessing that the attribute has been changed from func_code to
f_code but the inspect module wasn't updated to reflect that.
er i mean from f_code to func_code
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Dec 29, 2009 at 5:11 PM, inhahe inh...@gmail.com wrote:
On Tue, Dec 29, 2009 at 5:10 PM, inhahe inh...@gmail.com wrote:
So i'm guessing that the attribute has been changed from func_code to
f_code but the inspect module wasn't updated to reflect that.
er i mean from f_code
On Tue, Dec 29, 2009 at 6:38 PM, Irmen de Jong irmen-nosp...@xs4all.nl wrote:
On 29-12-2009 23:22, inhahe wrote:
inspect.getargvalues is used on frames, not on regular code objects.
Maybe you were looking for inspect.getargspec?
That explains it!
I knew I'd done this before, I was just
On Thu, Dec 3, 2009 at 9:16 AM, Lie Ryan lie.1...@gmail.com wrote:
On 12/2/2009 10:26 AM, allen.fowler wrote:
I've tried this, but have found two issues:
1) I can't set default values.
2) I can't set required values.
In both of the above cases, if the object is created without the
exact
On Thu, Dec 3, 2009 at 9:32 AM, inhahe inh...@gmail.com wrote:
On Thu, Dec 3, 2009 at 9:16 AM, Lie Ryan lie.1...@gmail.com wrote:
On 12/2/2009 10:26 AM, allen.fowler wrote:
I've tried this, but have found two issues:
1) I can't set default values.
2) I can't set required values.
In both
it seems to me like it should work just fine if you just take out the
second line where it just says nestedClass
On Wed, Dec 2, 2009 at 11:55 PM, cmckenzie mckenzi...@gmail.com wrote:
Hi.
I'm new to Python, but I've managed to make some nice progress up to
this point. After some code
or i guess you could go the middle-way and just use regex.
people generally say don't use regex for html (regex can't do the
nesting), but it's what i would do in this case.
though i don't exactly understand the question, re the html file
parsing script you say you have already, or how the date is
one point of confusion could be the use of ** instead of superscript.
it might make things a little bit more counterintuitive-looking than
with superscripts, since the issue with
would only apply to exponents, as
-5*4
and
a = -5
a*4
return the same answer, and superscripts make it a little
to put it simplistically it's a way of combining multiple variables into one
for example, for a person you could have
person.haircolor
person.echnicity
person.age
etc.
but you can then also manipulate 'person' as a whole like you would
any other variable, such as
x[n] = person
a struct, as far
On Mon, Nov 30, 2009 at 10:54 AM, Benjamin Kaplan
benjamin.kap...@case.edu wrote:
I don't know if anyone considers python's incomplete implementation of
closures a feature but it's documented so it's not really a bug
either. I believe there is a trick with default arguments to get this
to
i'm pretty new to javascript programming, but i'm pretty sure you just
need ajax, which AFAIK is a highly technical way of saying using
javascript in a way that makes web pages interactive
JSON afaik is a way of data to and from the server that allows for
lists and more variable types and such,
i don't understand the point of using 'with'
but i don't understand what 'with' does at all
i've tried to understand it a few times
anyway here:
import random
result = random.choice(open(c:\\test.txt).readlines())
On Mon, Nov 30, 2009 at 10:41 AM, Tim Golden m...@timgolden.me.uk wrote:
Olof
On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi
victorsube...@gmail.com wrote:
On Mon, Nov 30, 2009 at 1:39 PM, inhahe inh...@gmail.com wrote:
i'm pretty new to javascript programming, but i'm pretty sure you just
need ajax, which AFAIK is a highly technical way of saying using
javascript
On Mon, Nov 30, 2009 at 12:58 PM, inhahe inh...@gmail.com wrote:
On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi
victorsube...@gmail.com wrote:
If I'm not mistaken, that won't help me actually print to screen the user's
choices as he selects them, which in my application, is important
On Mon, Nov 30, 2009 at 12:22 PM, Manuel Graune manuel.gra...@koeln.de wrote:
Hello,
in (most) python documentation the syntax list()
and [] is treated as being more or less the same
thing. For example help([]) and help(list()) point
to the same documentation. Since there are at least
two
comprehensions, not generator comprehensions)
i.e. notice that you can do this
''.join(x for x in ['a','b','c'])
no list or [] involved - it's just a generator comprehension being
passed to a function.
On Mon, Nov 30, 2009 at 1:12 PM, inhahe inh...@gmail.com wrote:
On Mon, Nov 30, 2009 at 12:22 PM
On Mon, Nov 30, 2009 at 1:21 PM, Victor Subervi victorsube...@gmail.com wrote:
On Mon, Nov 30, 2009 at 2:00 PM, inhahe inh...@gmail.com wrote:
On Mon, Nov 30, 2009 at 12:58 PM, inhahe inh...@gmail.com wrote:
On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi
victorsube...@gmail.com wrote
On Wed, Nov 25, 2009 at 7:33 PM, ShoqulKutlu kursat.ku...@gmail.com wrote:
Hi,
Managing load of high volume of visitors is a common issue for all
kind of web technologies. I mean this is not the python issue. This
issue is mostly about server level designs. You need to supply load
balancing
the behavior, but I
find it somewhat counter-intuitive.
You shouldn't find it any more surprising than the fact that
a = 2 + 3
print a * 5
gives a different result from
print 2 + 3 * 5
On Mon, Nov 30, 2009 at 3:41 AM, inhahe inh...@gmail.com wrote:
one point of confusion could be the use
On Mon, Nov 30, 2009 at 2:17 PM, Lie Ryan lie.1...@gmail.com wrote:
On 12/1/2009 5:00 AM, inhahe wrote:
On Mon, Nov 30, 2009 at 12:58 PM, inhaheinh...@gmail.com wrote:
On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi
victorsube...@gmail.com wrote:
If I'm not mistaken, that won't help me
On Mon, Nov 30, 2009 at 2:05 PM, Lie Ryan lie.1...@gmail.com wrote:
On 12/1/2009 5:58 AM, inhahe wrote:
i wasn't suggesting it as a feature for python, just pointing out why
it might seem counterintuitive.
I'm interested, what do YOU (inhahe) think the result should be? Should both
become
maybe that thing in python 3 that someone mentioned is the answer, but
otherwise i always think Python should admit something like this:
a, b, c, *d = list
i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3, d=[4, 5]
not that that solves the None problem, though i don't have any feature
On Sun, Nov 29, 2009 at 4:42 AM, inhahe inh...@gmail.com wrote:
maybe that thing in python 3 that someone mentioned is the answer, but
otherwise i always think Python should admit something like this:
a, b, c, *d = list
i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3, d=[4, 5
On Sun, Nov 29, 2009 at 5:15 AM, The Music Guy
fearsomedragon...@gmail.comwrote:
Okay, I'm having a really hard time telling which messages are getting
on to the list and which ones aren't. Some of the messages I send show
up in the comp.lang.python mirror in Google Groups, and some aren't.
I had this same problem with an application called Notepad++, which is a
shame because I like the way it works and it's nice and tight. Now I use
Komodo Edit instead, which doesn't have that problem, and has all the
features of Notepad++ but just isn't as fast. Also all the colors were
awful,
I'm trying to come up with a system for singletons, where I don't have to
modify anything for an individual class except to define __metaclass__ or,
if possible, to inherit another class.
I want it to raise an error if making a duplicate instance of a class is
attempted, rather than to return the
On Sun, Nov 29, 2009 at 9:10 AM, n00m n...@narod.ru wrote:
Even if Py by 4x *slower* -- it's still a perfect Ok for it (C# will
be
much (much) slower than Python).
How do you figure? As far as I know C# is many, many times faster than
Python. (i was disappointed to find out that even
On Sun, Nov 29, 2009 at 10:40 AM, Mel mwil...@the-wire.com wrote:
Russell Warren wrote:
Maybe it's just that * is strictly for arguments, and trying it for
generic tuple unpacking is abuse (which is down the corridor in 12A).
I'd agree with that. It's a feature of function calls, not a
On Sun, Nov 29, 2009 at 8:04 PM, Esmail ebo...@hotmail.com wrote:
Chris Rebert wrote:
Wow .. never heard of Concatenative_languages languages before or the
distinction you make. Your distinction explains the behavior, but I
find it somewhat counter-intuitive. (I use the Python interpreter
i like this idea (i posted some thoughts on it in the blog, but it's not
approved yet as of this writing)
in short, i suggested extending the idea to make it more a) generalized, b)
simple, c) intuitive, and d) flexible.
so instead of just using $ for attributes, you could use it anywhere you
Can somebody clear this up for me?
--
Class B(A): def __init__(self, a) A.__init__(a) self.a = a a = A() ba = B(a)
bc = B(a) bd = B(a) -- I'm not sure what A.__init__ here does. I would
think its __init__ is designed specifically to run once for any given
object.. so i'm not sure what
On Mon, Oct 19, 2009 at 1:55 PM, inhahe inh...@gmail.com wrote:
On Sat, Oct 10, 2009 at 6:34 PM, Mensanator mensana...@aol.com wrote:
On Oct 10, 5:02�pm, kj no.em...@please.post wrote:
In 01ccc46d-5ea9-4dfe-ba22-699c6b859...@v36g2000yqv.googlegroups.com
Mensanator mensana...@aol.com
Can someone tell me why this doesn't work?
colorre = re.compile ('('
'^'
'|'
'(?:'
'\x0b(?:10|11|12|13|14|15|0\\d|\\d)'
'(?:'
I don't know how much the community knows about this - i haven't been
participating much of late - but here's something amazing.
Apparently javascript is just as dynamic as python, because someone made a
python-to-javascript converter in just 1200 line (pyjamas). Meanwhile
google's new
Alex Bryan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Okay, so i don't really understand the Yield thing and i know it is
useful. I've read a few things about it but it is all programming jargon
and so basically it is hard for me to understand. So can anyone give me a
How would I import a python file whose name contains characters like .'s or
!'s?
Is there really _no_ way to do that? I have to use plain jane letters and
numbers for everything?
--
http://mail.python.org/mailman/listinfo/python-list
Gandalf [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On May 30, 12:14 am, John Henderson [EMAIL PROTECTED] wrote:
Gandalf wrote:
how do i write this code in order for python to understand it
and print me the x variable
x=1
def ():
x++
if x 1:
i used py2exe with python 2.5 and it worked fine just the other day.
py2exe-0.6.6.win32-py2.5.exe was the download filename.
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Dear Members of the group,
py2exe does not seem to be integrating with 2.5 or later versions.
I was trying to
Bruno Desthuilliers [EMAIL PROTECTED] wrote in
message news:[EMAIL PROTECTED]
Brad a écrit :
cm_gui wrote:
Python is slow.
It ain't C++, but it ain't a punch card either... somewhere in between. I
find it suitable for lots of stuff. I use C++ when performance really
matters tho... right
Nick Craig-Wood [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
bukzor [EMAIL PROTECTED] wrote:
That does, in fact work. Thanks! I'm a little sad that there's no
builtin way to do it, owell.
def f(a, *args):
... print a
... for b in args: print b
...
import
inhahe [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
if we assume the constraints are that:
1.he has list, l
2.he has a dictionary, d
3.he wants the function to print the values in the dictionary according to
a specific order of their keys as defined by the function, followed
To be more specific, let's say I want to create a simple, 2D strategy
game. It will have a board layout like chess or checkers and the player
will move around the board. Let's say this is all I know, and perhaps I
don't even know *this* for sure either. Is it possible to write the
logic for
I wish this worked:
def main(a,b,*argv): pass
options['argv'] = argv
main(**options)
TypeError: main() got an unexpected keyword argument 'argv'
-
I was thinking about that exact same thing actually. Except that I was
thinking you might want it like this, otherwise it could be
Dutton, Sam [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Thanks for all the answers and comments.
math.pi is exactly equal to 884279719003555/281474976710656, which is the
closest C double to the actual value of pi
So much for poor old 22/7...
Sam
The biblically correct
Paul Rubin http://[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
inhahe [EMAIL PROTECTED] writes:
planets are spherical (all implementations of Python are not natively
compiled (and you said for whatever definition)), and b) It's a far cry
to
imagine a planet coming into being
inhahe [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
4. can someone tell me if the way i'm using the decorator is sane? i've
never used decorators before. it just seems ridiculous to a) define a
lambda that just throws away the parameter, and b) define a meaningless
function
Ma: Symbolic identity is a mathematical relation
Mb: Symbols are acausal
m: Matter is causal
C: Symbolic identity is not defined on matter.
What is defined on matter then? You're saying all symbolism is not defined
on matter. Much of our thinking about the world itself is symbolic. How do
we
inhahe [EMAIL PROTECTED] wrote in message news:...
Ma: Symbolic identity is a mathematical relation
Mb: Symbols are acausal
m: Matter is causal
C: Symbolic identity is not defined on matter.
I do think though that a computer languages claiming operations on
'identity', as vis a vis
inhahe [EMAIL PROTECTED] wrote in message news:...
inhahe [EMAIL PROTECTED] wrote in message news:...
Ma: Symbolic identity is a mathematical relation
Mb: Symbols are acausal
m: Matter is causal
C: Symbolic identity is not defined on matter.
I do think though that a computer languages
Dutton, Sam [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I've noticed that the value of math.pi -- just entering it at the
interactive prompt -- is returned as 3.1415926535897931, whereas (as every
pi-obsessive knows) the value is 3.1415926535897932... (Note the 2 at the
Dutton, Sam [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I've noticed that the value of math.pi -- just entering it at the
interactive prompt -- is returned as 3.1415926535897931, whereas (as every
pi-obsessive knows) the value is 3.1415926535897932... (Note the 2 at the
I don't get what the issue is between sites that use Python and being slow,
if there is one, because there's a website online that shows the results of
a dozen or so benchmarks when comparing any two languages. Python beats PHP
in almost all the benchmarks. (it also beats almost all the other
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
import Tkinter
from Tkinter import *
i have a program where if i comment out either of those import-
statements i get an error.
i thought they meant the same thing and from was supposed to be just
to imort just a specific function
Might have a stack overflow issue, if it retries too many times?
alex23 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On May 22, 6:15 pm, Karlo Lozovina [EMAIL PROTECTED] wrote:
Because when you expect exception to occur on something like 0.01% of
cases, and you have 4 or 5
Joel Koltner [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Is there an easy way to get a list comprehension to produce a flat list
of, say, [x,2*x] for each input argument?
E.g., I'd like to do something like:
[ [x,2*x] for x in range(4) ]
...and receive
[ 0,0,1,2,2,4,3,6]
I don't like php. I tried it once and I had it sort a list, but the list
was apparently too long for its sorting function because it just sorted the
first so-many elements of it and left the rest in order, and didn't generate
any error. I like a language that's actually determined by what you
it seems like you can't do it exactly the way you're trying but you could do
this
def __getitem__(*args):
if len(args) 1 and args[1]: return self.get(args[0]) * 5
return self.get(args[0])
then you would use it like
print foo['a']
print foo['a',True]
or even
print foo['a',crazy]
if you
inhahe [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
crazy = True
print foo['a',crazy]
just to clarify, you could use it like:
crazy = I'm crazy #this only has to be done once
print foo['a'] #not crazy
print foo['a',crazy] #crazy
(this may be totally unPythonic, i
actually i ddin't think about the fact that you're overloading dict, which
can already take multiple values in getitem
so how about
class crazy: pass
and then in your dict class:
def __getitem__(*args):
if args[-1] is crazy:
return self.get(args[:-1])*5
else:
return self.get(args)
Apparently, args already is a tuple, so this should be:
def __getitem__(self, args):
Is this documented somewhere? I couldn't find it anywhere.
Don't know, I just assumed it would take multiple arguments because I knew I
had seen the form d[1,2] before, which incidentally is equivalent
bukzor [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
This question seems easy but I can't figure it out.
Lets say there's a function:
def f(a, *args):
print a
for b in args: print b
and elsewhere in your program you have a list and a dict like this:
args = [2, 3]
1
2
actually, you don't want it to print 3 also? if not, then you would do
f(*map(kwargs.get, inspect.getargspec(f)[0])+args[:1])
import inspect
f(*map(kwargs.get, inspect.getargspec(f)[0])+args)
--
http://mail.python.org/mailman/listinfo/python-list
PHP can do that. There are also a number of templating engines
available. The nice thing about PHP is you have a choice.
i just meant that php is sort of invented to combine html and code, so if
you use python instead you should use a templating engine. but i suppose
it's useful for php
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Shakir,
I have thousands of records in MS Access database table, which records I
am fetching using python script. One of the columns having string like
'8 58-2155-58'
Desired output: '858215558'
I want to remove any spaces
i don't know how i would get around the problem, though, because i'd have
to know how to access the deque object that my class stores when i do
deque.__init__ in my constructor, so that i could pickle it and my class
variables separately.
i decided i could just pickle deque(self), which
maybe you could instead of killing the program stop the loop that starts
new processes and start one that runs until the last process ends?
also, if you killed the program but stdout was still set to fd and stderr
was still set to subprocesses.STDOUT, what would happen when those two
objects
i always just put most of my python files in the c:\python25 directory.
including ones i want to import as modules, since they import from there.
otherwise you can put the file in c:\python25\lib\site-packages
srinivas [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
hi friends i am
one of the few things i miss from C is being able to use assignment in
expressions. that's the only thing, really.
also there's no switch/case, you have to use a dictionary of functions
instead, although i rarely need that, usually i just use elif.
[EMAIL PROTECTED] wrote in message
1 - 100 of 141 matches
Mail list logo