Gotcha. Thank you for the examples. I think the following is
particularly sweet:

  >>> a, b = (val*10 for val in (a,b))

I guess I wasn't quite specific enough in my explanation, in that I
needed both to modify e.a,e.q and transport something across sftp
based on their contents. As I think about it, I could probably do that
functionally if the whole of my code were more functional, but as it
stands there wasn't an easy way with a functional definition.

I was mainly just disappointed that I had to settle with the less
elegant solution. A matter of scope to be sure, I was hoping there was
some nifty fix. (:

I'll meditate on your code. Thanks for the help. (:

--Joe

On Oct 4, 9:30 pm, Ben <[email protected]> wrote:
> I'm not sure what you're trying to change in your python example.  But
> python has lexical scoping now so my suggestion would be:
>
>   def f(val): return <something based on val apparently>
>   e.a = f(e.a)
>   e.q = f(e.q)
>
> even if that block is within a function or method.  If the f(val)
> function is very short, you can express it the way you did with less
> notation:
>
>   e.a, e.q = (<something based on val> for val in (e.a, e.q))
>
> IMHO both of these options are clear/easy-to-read.  In case what I'm
> talking about is confusing, here are concrete examples:
>
>   >>> a = 1; b = 2
>   >>> def f(val): return val*10
>   ...
>   >>> a = f(a)
>   >>> b = f(b)
>   >>> a
>   10
>   >>> b
>   20
>
> or
>
>   >>> a = 1; b = 2
>   >>> a, b = (val*10 for val in (a,b))
>   >>> a
>   10
>   >>> b
>   20
>
> --
> Ben
>
> ----------------- Original message -----------------
> From: Joseph <[email protected]>
> To: mnemosyne-proj-users <[email protected]>
> Date: Sun, 4 Oct 2009 17:33:12 -0700 (PDT)
>
> Alright.
>
> http://icogsci1.ucsd.edu/~jschilz/memServer/download/memServerPlugin.zip
>
> Added:
> Image/latex support. It automatically adjusts filenames and puts them
> on the server for you.
> Automatic file permission setting.
> Feedback wrt sftp. I've got a bit more to add, though.
> Line to check if the current card has been scored via import before
> getting a new card.
>
> Yet to do:
> Multiple scoring for cards you fail.
> Feedback (data file not found, no more cards to review, etc.) in the
> php script.
> Randomization, per the revision_queue
>
> Other issues:
> I haven't quite figured out what to do about host keys. Paramiko
> doesn't throw you the host key in the event of an unfound key, and I
> haven't dug into the situation too thoroughly yet. I still have to add
> some usability on the php side, make sure it looks good on the touch,
> etc. I'll put my LaTeX header here, once I get something that looks
> good.
>
> A couple statements:
> I think the required tech savvy on this will remain high. Given that
> mnemosyne 2.0 is going to cover this feature set, I think I'll just
> leave it here in the google group and not invest too much more energy
> into making it user friendly. So feel free to direct people here if
> they're interested in something in something they can run from their
> touch/iPhone, but I don't think I'm going to upload it to the plugins
> page.
>
> And as before, it's my first Python project. So, I'm sure some things
> are dirty, and some things I had to derive with a load of copy and
> paste.
>
> And a Python question:
> I've got 'e', a copy of an item. And I'm trying to make the same
> changes to both e.q and e.a. I was hoping it could look something
> like:
>
>     for s in [e.a,e.q]:
>
>         s = ...
>         ...
>
> But no changes seemed to stick to e.a and e.q until I used something
> like:
>     s=[e.a, e.q]
>     for i in [0,1]:
>
>         s[i] =
>         ...
>     [e.a,e.q]=s
>
> Is that how it has to work?
>
> Thanks,
> Joe
>
> On Oct 1, 7:08 pm, Joseph <[email protected]> wrote:
> > @Peter:
>
> > Sounds good, I've added an if to check whether the card we're scoring
> > is the card being displayed, prior to calling newCard. I'll upload
> > that and a couple new features soon.
>
> > @Ryein:
>
> > Ultimately, it should work with whatever cards you use on your own
> > desktop. You'll just be exporting your own cards onto a web server.
> > I'm guessing it's easy enough to have full Japanese support on the
> > IPod's Safari, though, so that should work.
>
> > --Joe
>
> > On Oct 1, 6:25 pm, Ryein <[email protected]> wrote:
>
> > > Are there any romanji cards?
>
> > > On Thu, Oct 1, 2009 at 11:31 AM, Peter Bienstman
>
> > > <[email protected]> wrote:
>
> > > > On Wednesday 30 September 2009 09:42:36 pm Joseph wrote:
> > > >> Peter,
>
> > > >> I believe it does. It uses your own process_answer, which I see
> > > >> includes some log functions. Looking at dlg's gradeAnswer, it looks
> > > >> like I'm doing everything log related. Though it looks like I should
> > > >> be catching the interval and including something like:
>
> > > >> if get_config("show_intervals") == "statusbar":
> > > >>             self.statusBar().message(self.trUtf8("Returns in ").append
> > > >> (\
> > > >>                 str(interval)).append(self.trUtf8(" day(s).")))
>
> > > > Don't worry about this, that is a hidden feature.
>
> > > >> The one thing I wasn't sure about was if it's OK to call newQuestion()
> > > >> and updateDialog() even in cases where I have imported no new scores,
> > > >> or when the current card does not have a new score. As it stands, I
> > > >> call these every time I sync, and there doesn't appear to be any
> > > >> problem.
>
> > > > updateDialog does not hurt, but it seems to me that calling newQuestion 
> > > > before
> > > > anything has happened to the current card is not a good thing.
>
> > > > I guess there could also be corruption if you export to the html 
> > > > server, and
> > > > then still do reviews on the desktop.
>
> > > > Cheers,
>
> > > > Peter
>
> > > > ------------------------------------------------
> > > > Peter Bienstman
> > > > Ghent University, Dept. of Information Technology
> > > > Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium
> > > > tel: +32 9 264 34 46, fax: +32 9 264 35 93
> > > > WWW:http://photonics.intec.UGent.be
> > > > email: [email protected]
> > > > ------------------------------------------------
>
> > > --
> > > Ryein Bowling
> > > Cell 503-689-2377 Home 503-608-4728
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"mnemosyne-proj-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mnemosyne-proj-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to